Skip to content

Switch URL protocol for resource links to HTTPS #1

@pilafmon

Description

@pilafmon

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",

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions