Skip to content

Support for Custom Headers

Compare
Choose a tag to compare
@instanceofMA instanceofMA released this 20 Feb 20:44
· 10 commits to main since this release

Library syntax has updated and dot notation (headers.contentType) for setting headers in RequestOptions is dropped in favor of square-brackets notation headers["Content-Type"] because the latter supports custom headers:

This will break:

RequestOptions options;
options.headers.contentType = "application/json";

This now works:

RequestOptions options;
options.headers["Content-Type"] = "application/json";

Syntax for accessing response headers is also updated:

Old syntax:

response.headers.get("Content-Type");

New syntax:

response.headers["Content-Type"];

Thank you all for your feedback. Keep supporting! ❤️

Full Changelog: 0.0.3...0.1.0