Is here assuming all responses are using "Content-Type: application/json"?
See original GitHub issueI am hitting an issue that sam-local
response contains multiple contradicted “Content-Type” header. Please see the following curl
command debugging output. In my API, the only Content-Type defined is text/plain
format, but using the sam-local test, its response message contains an extra “Content-Type” header application/json
. Could you please confirm is this line injecting the header, if so, can this assumption be removed and honor the response header returned by Lambda functions?
Please see the following out console output.
$> curl -v -H "Accept: text/plain" http://127.0.0.1:3000/resources/greeting
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 3000 (#0)
> GET /resources/greeting HTTP/1.1
> Host: 127.0.0.1:3000
> User-Agent: curl/7.54.0
> Accept: text/plain
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Type: text/plain
< Date: Mon, 19 Mar 2018 07:21:00 GMT
< Content-Length: 5
<
* Connection #0 to host 127.0.0.1 left intact
Hello
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Content-Type: application/json is forced as response header ...
I use aws-sam-local local start-api for local development. However all the resources have a Content-Type: application/json header set, ...
Read more >Which JSON content type do I use? - Stack Overflow
The correct MIME media type for JSON is application/json . JSP will use it for sending a response to the client. Share.
Read more >CFC, returnForm, JSON, and content-type - Raymond Camden
I'm assuming cfajaxproxy actually ran the CFC when creating the proxy. This seems to be an issue with cfajaxproxy only though. I changed...
Read more >Blogger JSON API: Performance Tips - Google Developers
This document covers some techniques you can use to improve the performance of your application. In some cases, examples from other APIs or ......
Read more >Best practices for REST API design - Stack Overflow Blog
Accept and respond with JSON. REST APIs should accept JSON for request payload and also send responses to JSON. JSON is the standard...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
confirmed.
$ curl -v --header 'Accept:text/html' 'http://localhost:8080/'
yields
This should be fixed in our newest release: https://github.com/awslabs/aws-sam-cli/releases/tag/v0.3.0
Please feel free to reopen if the issue persists.