aurelia / http-client

A simple, restful, message-based wrapper around XMLHttpRequest.
MIT License
62 stars 59 forks source link

baseUrl should be ignored with absolute paths #101

Closed heruan closed 9 years ago

heruan commented 9 years ago

Since I'm reading Link headers from a remote service and they are absolute URIs, I need to strip the baseUrl before using my http-client instance configured with a baseUrl; I think it would be logical to ignore the baseUrl when a path starts with http[s]://.

See PR https://github.com/aurelia/http-client/pull/102.

Cedware commented 8 years ago

This does not work for me:

http.configure(conf=>{
    conf.withBaseUrl("http://localhost:51713");
    conf.withDefaults({method: "POST", credentials: "include"});    
});

this._http.fetch("http://localhost:8080/Resources/menustore.json", { method: "GET",}), creates a Request with http://localhost:51713http://localhost:8080/Resources/menustore.json as url

heruan commented 8 years ago

This is http-client repo, it seems you're using fetch-client.

bryanrsmith commented 8 years ago

@Cedware heruan is correct; you're using aurelia/fetch-client. I have opened a PR that fixes the problem in that library. It should go out in the next release. Thanks for the report!