meliorence / react-native-image-gallery

Pure JavaScript image gallery component for iOS and Android with high-performance and native feeling in mind

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Loading images with headers makes 2 requests and first doesn't have header information

JanithaR opened this issue · comments

I was facing an undesired outcome with this module and with the help of Charles Proxy I managed to find out when loading an image like this,

{
                    source: {
                        uri: 'http://webapitest/api/ReferenceArchive/GetImage/6126e75e-3303-4f25-ac63-0e8e51541572',
                        headers: {
                            'MobilePlatformId': '1',
                            'ApplicationId': '1',
                            'Version': '2.0.0',
                            'Token': 'where_s_waldo'
                        }
                    }
                }

the module makes two requests and the first one always fails because header information is not present. Here's a screenshot of Charles. There's just one image in the array.

This is the first request,

curl -H "Host: webapitest" -H "Accept: /" -H "User-Agent: Demo/1 CFNetwork/893.14 Darwin/16.7.0" -H "Accept-Language: en-us" --compressed http://webapitest/api/ReferenceArchive/GetImage/6126e75e-3303-4f25-ac63-0e8e51541572

And here's the second,

curl -H "Host: webapitest" -H "MobilePlatformId: 1" -H "ApplicationId: 1" -H "Accept: /" -H "Version: 2.0.0" -H "Accept-Language: en-us" -H "Token: where_s_waldo" -H "User-Agent: Demo/1 CFNetwork/893.14 Darwin/16.7.0" --compressed http://webapitest/api/ReferenceArchive/GetImage/6126e75e-3303-4f25-ac63-0e8e51541572

Despite second request being successful the Gallery still shows image loading failed message.

So I was doing some debugging and this issue is related to #81 .
Giving dimensions fixes the problem and now I'm riddled with the problem of either updating my API to send the size before hand or consider some other method to get the size before hand.