aws4fetch icon indicating copy to clipboard operation
aws4fetch copied to clipboard

POST with empty body

Open smilingthax opened this issue 1 year ago • 0 comments

According to the documentation:

method - if not supplied, will default to 'POST' if there's a body, otherwise 'GET'

This does not work for AWS APIs (e.g. MediaLive /prod/channels/:channelId/start) that expect just an empty POST (i.e. Content-Length: 0 / body: "").

Proposed fix: Test body != null (i.e. treating null/undefined as not present, as in TS type body?: BodyInit | null), instead of boolean-evaluating body, here: https://github.com/mhart/aws4fetch/blob/03f98026fc502f2c585744dbedd908bac62baed0/src/main.js#L153

smilingthax avatar Mar 28 '23 16:03 smilingthax