Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

JSON POST headers

Topic Labels: Scripting extentions
1313 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Martin_Wright
4 - Data Explorer
4 - Data Explorer

In a fetch for JSON POST adding these two headers:

let response = await fetch(url, {
    method: 'POST',
    body: JSON.stringify(data),
    headers:
    {
        'Content-Type': 'application/json',
        'Accept': 'text/plain', 
    }
});

returns a TypeError: Load failed message. But the target API needs both headers specified. Each header individually does not error, but the API doesn’t respond.

Any help appreciated.

1 Reply 1
Martin_Wright
4 - Data Explorer
4 - Data Explorer

Solved by using remoteFetchAsync instead of fetch.