arc.http.async defaults body to '\n'
alexbepple opened this issue · 4 comments
alexbepple commented
Describe the issue
Whereas
exports.handler = async req => ({ statusCode: 202 })
returns an empty response,
exports.handler = arc.http.async(async req => ({ statusCode: 202 }))
returns '\n' in the body (both in the sandbox and deployed). I think it might be coming from https://github.com/architect/functions/blob/master/src/http/_res-fmt.js#L17
This looks like a bug to me.
Expected behavior
I would still expect an empty response.
Additional context
@architect/functions@3.7.6
brianleroux commented
Heh unbelievably we are mimicking observed behavior in API gateway tho possibly something changed.
alexbepple commented
related: architect/architect#317
ryanblock commented
I think something at some point changed, and API Gateway must no longer be doing this. Reproduced below (curl -i
):
# Sandbox: arc.http
HTTP/1.1 202 Accepted
Content-Type: application/json; charset=utf8
Cache-Control: no-cache, no-store, must-revalidate, max-age=0, s-maxage=0
Date: Wed, 25 Mar 2020 03:42:58 GMT
Connection: keep-alive
Content-Length: 1 # followed by line break in body
# Sandbox: bare
HTTP/1.1 202 Accepted
Content-Type: application/json; charset=utf-8
Date: Wed, 25 Mar 2020 03:43:29 GMT
Connection: keep-alive
Content-Length: 0
# Real AWS: arc.http
HTTP/2 202
date: Wed, 25 Mar 2020 03:49:21 GMT
content-type: application/json; charset=utf8
content-length: 1 # followed by line break in body
x-amzn-requestid: 9fc029e8-00d2-4fb8-8f4d-b3ccdfc7312e
x-amz-apigw-id: J7YuOELAIAMFtzQ=
cache-control: no-cache, no-store, must-revalidate, max-age=0, s-maxage=0
x-amzn-trace-id: Root=1-5e7ad4c1-0bb728a17c1698f75951003c;Sampled=0
# Real AWS
HTTP/2 202
date: Wed, 25 Mar 2020 03:47:16 GMT
content-type: application/json
content-length: 0
x-amzn-requestid: 1e20250f-51db-4d54-a9d5-920b846255a5
x-amz-apigw-id: J7YavHE-oAMFW9w=
x-amzn-trace-id: Root=1-5e7ad444-ee21ca526510e5ce1db98eec;Sampled=0
Stand by for patch...
ryanblock commented
Will be released tonight in 3.8.1
, thanks @alexbepple!