solid-contrib/solid-web-client

Return absolute url for response.location

Closed this issue · 1 comments

In some situations (such as when creating a new folder on node-solid-server and getting back a 201 Created response), the Location: header returned by the server is a relative url.
Change it to be an absolute location (relative to the original request url).

So, for example, currently:

return webClient.createContainer('https://example.com/', 'test-container')
  .then(response => {
    console.log(response.xhr.getResponseHeader('Location')) // -> '/test-container/'
  })

Instead, it should be:

return webClient.createContainer('https://example.com/', 'test-container')
  .then(response => {
    console.log(response.location) // -> 'https://example.com/test-container/'
  })

Fixed by PR #7, closing.