0

i set the headers in server, resp.setHeader("Authorization", "xxxxxxx"); and the headers of http response is all right. from the chorm,i got the info as below: enter image description here but from the angular $http headers function,i can't get the value i set. i try to get value use: console.log(response.headers()); console.log(response.headers("Authorization"));

the console print: enter image description here

how to get the value? tks

1 Answer 1

1

you can get header in angular like this

                   $http.get(_uri, { responseType: 'arraybuffer' })
                              .success(function (data, status, headers) {
                                  if (status === 200) {
                                      headers = headers();
                                      var content = headers['content-disposition'].split('=');

                                  } else {

                                  }
                              })
Sign up to request clarification or add additional context in comments.

1 Comment

$http.get(BASE_URL + "/authKaptcha/captcha.jpg?a=", { responseType: 'arraybuffer' }) .success(function (data, status, headers) { if (status === 200) { headers = headers(); //var content = headers['content-disposition'].split('='); console.log(headers['content-disposition']); } }) i just want to get a image from server,but console print undefined

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.