question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to read response headers

See original GitHub issue

Hi Danial. Is there a way to get access to the response headers on success of the upload? I’m using:

file.upload.success(function (data, status, headers, config) {
    console.log(status);
    console.log(headers);
    console.log(headers['Location']);
});

Console returns:

204 function anonymous(name) undefined

Network tab shows Response Headers correctly as in this screenshot: http://cl.ly/image/2f1A1O2X0s3N

Any help? Thanks!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
marianocarpentiercommented, Nov 3, 2015

I managed to get the headers from an S3 upload by exposing the headers in the CORS config in my bucket:

<?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/&quot;&gt; <CORSRule> <AllowedOrigin></AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <AllowedMethod>POST</AllowedMethod> <AllowedMethod>PUT</AllowedMethod> <AllowedHeader></AllowedHeader> <ExposeHeader>Location</ExposeHeader> <ExposeHeader>ETag</ExposeHeader> <ExposeHeader>Date</ExposeHeader> </CORSRule> </CORSConfiguration>

By doing so, this works:

file.upload.then(function (data) { console.log(data.headers()); console.log(data.headers(‘Location’)); }

0reactions
JoshuaNovak919commented, Nov 2, 2016

@marianocarpentier Thanks!! Saved me so much time!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to troubleshoot the error "Failed to process response ...
In almost every event, this error is caused by a connection failure. The error is correct, the service did not receive any response...
Read more >
Issue with getting response headers - Stack Overflow
I'm passing pagination information in response header and unable to get using following method in angular 8. I'm getting 0 all the time...
Read more >
couldn't read response headers (HTTP::ConnectionError) #459
I get this error when using persistent connection with high keep_alive_timeout value. Test script: require "http" url ...
Read more >
Unable to get/access CSRF Token in login api response ...
So you're setting the Authorizarion Header of the request like Authorization: Bearer <the-token-value-from-the-cookie> or Authorization: Token < ...
Read more >
Response Header - an overview | ScienceDirect Topics
Access-Control-Expose-Headers—A list of headers that the browser may make visible to the client. For example, JavaScript would be able to read exposed headers...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found