Skip to content

Conversation

benonymity
Copy link

I spent a great deal of time debugging why

response = await HTTP.post(apiUrl, {
    body: JSON.stringify(requestPayload),
    headers: {
        'Content-Type': 'application/json'
    }
});

was sending a malformed body. I eventually removed JSON.stringify() from my payload and the request worked. Turns out there is no check for whether the body is a string or an object, so all strings are re-stringified, which messes up the body. This just adds a simple check to only stringifies non-bodies.

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.

1 participant