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.

Image headers unsupported when an array of sources is provided

See original GitHub issue

I’m trying to use the new headers prop on images in Android. I’ve managed to get it working on Android but it didn’t behave as expected (and I believe its undocumented so was guessing on how to use it).

For a simple image source it works fine, something like this:

<Image source={uri: foo, headers: {Authorization: bar}} ...

But in my case I want to pass an array of different sized images. I assumed this would be the correct approach:

<Image source={[
    {uri: foo, headers: {Authorization: fooHeader}, 
    {uri: bar, headers: {Authorization: barHeader} ...

But that doesn’t work (and the error message that comes back when my auth fails does seem to have any information in it). Looking at this code, I noticed that it always expects the headers prop to be at the top level, so one headers prop for all images (unlike the cache prop which is one per uri). As the source object is an array, so I ended up with something like this:

const sourceArray = [[uri: foo], [uri: bar]];
sourceArray.headers = headers;

Is this by design? It doesn’t feel quite right to me - I was expecting the headers prop to be treated more the the cache prop. Having said that, I can’t see any evidence of the cache header being implemented in android.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
hramoscommented, Oct 12, 2017

Looks like #16155 was merged, thanks @phillip055

0reactions
facebook-github-botcommented, Oct 12, 2017

Hey, thanks for reporting this issue! It looks like your description is missing some necessary information, or the list of reproduction steps is not complete. Can you please add all the details specified in the Issue Template? This is necessary for people to be able to understand and reproduce the issue being reported. I am going to close this, but feel free to open a new issue with the additional information provided. Thanks! See “What to Expect from Maintainers” to learn more.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Media or Image Source element - HTML - MDN Web Docs
It is a void element, meaning that it has no content and does not have a closing tag. It is commonly used to...
Read more >
Unsupported Media Type in postman - Stack Overflow
Http 415 Media Unsupported is responded back only when the content type header you are providing is not supported by the application.
Read more >
415 Unsupported MediaType in Spring Application - Baeldung
In this tutorial, we're going to showcase the causes and resolutions of the HTTP response code 415 Unsupported MediaType for POST requests ...
Read more >
PE Format - Win32 apps - Microsoft Learn
File Headers. MS-DOS Stub (Image Only); Signature (Image Only); COFF File Header (Object and Image). Machine Types ...
Read more >
HTTP security headers: An easy way to harden your web ...
Modern browsers support a wide array of HTTP headers that can improve web ... permitted sources for scripts, CSS stylesheets, and images.
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