Skip to content

2.0.0

Latest
Compare
Choose a tag to compare
@amanteaux amanteaux released this 11 Oct 11:27
· 14 commits to master since this release

Changelog

This release adds the ability to change the host name of a request with the new method: HttpRequest.hostname(hostname: string)

Ideally this would have been done by modifying the Host header, but since this header is part of the forbidden headers, another implementation has been used: the base URL is built using the Javascript URL object, so it is then possible to change hostname directly in this object.

This changes is detailed in commit 165bdb2.

Upgrade instructions

The HttpRequest constructor now requires a valid string base URL, whereas the previous implementation allowed a relative URL like /api . This relative URL worked only in a browser environment. In this case, the base URL construction must now be replaced by ${window.location.protocol}//${window.location.host}/api.