Skip to content

Commit

Permalink
fix bug with empty body
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Pflueger <justin.pflueger@fermyon.com>
  • Loading branch information
jpflueger committed Mar 28, 2023
1 parent 531cac4 commit 1ba697f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions scripts/test-auth0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

source .envrc

# set -x

AUTH_BODY=$(jq --null-input \
--arg client_id "${AUTH0_CLIENT_ID}" \
--arg client_secret "${AUTH0_CLIENT_SECRET}" \
Expand Down
1 change: 1 addition & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ impl Default for Config {
fn default() -> Self {
let jwks_uri = config::get(JWKS_URI).expect("Missing required config item 'jwks_uri'");

//TODO: add logging for parse errors
let issuers = config_get_set(ISSUERS).ok();
let audiences = config_get_set(AUDIENCES).ok();
let max_validity: Option<Duration> = config_get_duration(MAX_VALIDITY_SECS).ok();
Expand Down
3 changes: 2 additions & 1 deletion src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ impl TryInto<VerificationRequest> for Option<&Bytes> {
type Error = anyhow::Error;
fn try_into(self) -> Result<VerificationRequest, Self::Error> {
match self {
Some(b) => serde_json::from_slice::<VerificationRequest>(b).map_err(|e| e.into()),
None => Ok(Default::default()),
Some(b) if b.len() == 0 => Ok(Default::default()),
Some(b) => serde_json::from_slice::<VerificationRequest>(b).map_err(|e| e.into()),
}
}
}

0 comments on commit 1ba697f

Please sign in to comment.