Skip to content

fix: fix RequestExt.payload() for content-type with charset #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 26, 2021
Merged

fix: fix RequestExt.payload() for content-type with charset #255

merged 2 commits into from
Jan 26, 2021

Conversation

nmoutschen
Copy link
Contributor

Issue #, if available:

Description of changes:

This performs a starts_with() check instead of exact string match for Content-Type when using the RequestExt.payload() for lambda_http as a Content-Type could contain a charset. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type

By submitting this pull request

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I confirm that I've made a best effort attempt to update all relevant documentation.

@rimutaka
Copy link
Contributor

FYI - the MUSL build failed due to a network error. Here is the extract:

Run cargo build --all --verbose
    Updating crates.io index
 Downloading crates ...
warning: spurious network error (2 tries remaining): failed to get 200 response from `https://crates.io/api/v1/crates/cfg-if/0.1.10/download`, got 503
warning: spurious network error (2 tries remaining): failed to get 200 response from `https://crates.io/api/v1/crates/url/2.1.1/download`, got 503
warning: spurious network error (1 tries remaining): failed to get 200 response from `https://crates.io/api/v1/crates/cfg-if/0.1.10/download`, got 503
warning: spurious network error (1 tries remaining): failed to get 200 response from `https://crates.io/api/v1/crates/url/2.1.1/download`, got 503
error: failed to download from `https://crates.io/api/v1/crates/cfg-if/0.1.10/download`

Caused by:
  failed to get 200 response from `https://crates.io/api/v1/crates/cfg-if/0.1.10/download`, got 503
##[error]Process completed with exit code 101.
##[error].github/workflows/build.yml (Line: 54, Col: 28): Unexpected value ''

I compiled it locally with cargo build --release --target x86_64-unknown-linux-musl

@nmoutschen
Copy link
Contributor Author

Thanks @rimutaka ! I noticed as much but I don't have permission to re-run that step to see if it works. 😄

Copy link
Contributor

@softprops softprops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good to me

Copy link
Contributor

@bahildebrand bahildebrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Ran the musl build locally and it worked.

@bahildebrand bahildebrand merged commit 04712a3 into awslabs:master Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants