forked from phalt/swapi
-
Notifications
You must be signed in to change notification settings - Fork 98
Closed
Labels
Description
The parent project has an issue filed to make the resource links the same protocol as the request.
Change URL protocol in response data based on whether the request was made over HTTPS:
phalt#66
Since the swapi.dev server uses HTTPS (it even redirects HTTP to HTTPS) and the world has pretty much switched over to HTTPS, it probably makes sense to just do a simple straight switch to HTTPS. There's little value in making the response intelligent based on the protocol of the request.
Currently the next field in responses uses the HTTP protocol:
GET https://swapi.dev/api/vehicles/?format=json
{
"count": 39,
"next": "http://swapi.dev/api/vehicles/?page=2&format=json",
"previous": null,
"results": [
{
"name": "Sand Crawler",
"model": "Digger Crawler",
"manufacturer": "Corellia Mining Corporation",
"cost_in_credits": "150000",
"length": "36.8 ",
"max_atmosphering_speed": "30",Following the next link can result in errors like:
Fetch API cannot load http://swapi.dev/api/vehicles/?page=2&format=json due to access control
This problem would be resolved by using HTTPS in the next field:
"next": "https://swapi.dev/api/vehicles/?page=2&format=json",donavon, neoreddog, berkandirim, sauntimo, in-in and 4 more