Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set header in 0.5.2 #19

Closed
yale opened this issue Feb 17, 2015 · 4 comments
Closed

Cannot set header in 0.5.2 #19

yale opened this issue Feb 17, 2015 · 4 comments
Labels

Comments

@yale
Copy link

yale commented Feb 17, 2015

Hi! I'm not able to set a header on 0.5.2, neither by using the configure function nor the withHeader function:

import {HttpClient} from 'aurelia-http-client';

export class Spacemoney{
  static inject() { return [HttpClient]; }

  constructor(http) {
    this.env = 'development';
    this.apiToken = '...';
    this.http = http.request.withHeader('Authorization', 'Token token="' + this.apiToken + '"');
  }
  ...
}

When the request is made, no Authorization header is set. Let me know if there's any more information I can provide that would help.

BTW, I have been building a sideproject using Aurelia for the past 72 hours, and I am in love. I'm so excited to see this project mature!

@EisenbergEffect
Copy link
Contributor

We have tests case that verify that this works. So, something unexpected is going on. Is it possible for you to create a test case for this that fails?

@yale
Copy link
Author

yale commented Feb 18, 2015

Ah! jsonp does not permit setting HTTP headers, since it's executed using a script tag src. No bug to see here folks!

@yale yale closed this as completed Feb 18, 2015
@EisenbergEffect
Copy link
Contributor

Glad you worked it out.Thanks for updating us!

@janvanderhaegen
Copy link

Just for future reference, Authorization header is never sent unless you do CORS (see #43)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants