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

Android project-wide requests headers substitution/rewritten by Giphy #92

Closed
topheroes opened this issue Jan 17, 2023 · 4 comments
Closed

Comments

@topheroes
Copy link

Hello,

@giphy/react-native-sdk changes the headers and makes it impossible to request images with headers. The following code snippet

import React, {useEffect} from 'react';

import {Text, Image} from 'react-native';

import {GiphySDK} from '@giphy/react-native-sdk';

GiphySDK.configure({apiKey: '*******************'});

const App = () => {
  useEffect(() => {
    Image.getSize('https://image2.requestcatcher.com/test', () => {});
  }, []);

  return <Text>Test</Text>;
};

export default App;

Makes request with the following headers

GET /test HTTP/1.1
Host: image2.requestcatcher.com
Accept-Encoding: gzip,br
Cache-Control: no-store
Connection: Keep-Alive
User-Agent: okhttp/4.9.1
X-Giphy-Sdk-Name: CoreSDK,UISDK,RNSDK
X-Giphy-Sdk-Platform: Android
X-Giphy-Sdk-Version: 3.1.12,2.3.0,1.0
X-Giphy-Ui-Sdk-Is-Extension: false

So it's impossible to use Image.getSizeWithHeaders or FastImage with headers.

React native: 0.66.5
@giphy/react-native-sdk: 2.1.1
Android: 11

@pshoniuk
Copy link
Contributor

Hi @topheroes, thanks for reaching out!
We have found the root of the issue. This is because both RN and GIPHY SDK use Fresco with custom configs under the hood. But because the GIPHY SDK initializes after RN, we override the HTTP client in Fresco, which was installed by RN before.
We are exploring possible solutions and don't have more information now. We will let you know when there are more details.

@topheroes
Copy link
Author

Hi, @pshoniuk

Any updates? Can you suggest any temporary fix?

@pshoniuk
Copy link
Contributor

pshoniuk commented Feb 7, 2023

Hi @topheroes

Unfortunately, it isn't easy to make some temporary fix. But we plan to release a new version with a fix in the next two weeks.

@pshoniuk
Copy link
Contributor

pshoniuk commented Feb 8, 2023

Hi @topheroes
We have released a fix in v2.1.2. Please check it when you get a chance. If the problem still occurs, please reopen this issue or create a new one.

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

No branches or pull requests

2 participants