Description
Environment
library version: 0.11.2
react: 16.13.0
react-native: 0.61.5
OS: Android
Description
there is this strange problem we are facing while trying to make a post request on android:
the header key we pass to the JS
API is:
'X-MOBILE-APP-VERSION'
however on the native
side RNFetchBlob tries to set the header as:
x-mobıle-app-versıonnull
this issue happens only when device's language is set to Turkish and the header is in caps. ( presumably ,depending on the header, other non ASCII languages should face the same problem)
Speculation
seems to be originating from .toLowerCase()
in RNFetchBlobReq.java
StackTrace:
Error RNFetchBlob request error: Unexpected char 0x131 at 5 in header name: x-mobıle-app-versıonnull node_modules/rn-fetch-blob/index.js:307:25 node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:483:12 value node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:28 node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:384:8 value node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:17 value [native code] value
CodeSample
const response = await RNFetchBlob
.config({ timeout: 4000 })
.fetch('POST', `${URL}`, {
'Content-Type': 'application/json',
Accept: 'application/json',
'X-MOBILE-APP-VERSION': Config.APP_VERSION,
'X-MOBILE-APP-MARKET': Config.APP_MARKET,
'User-Agent': await userAgent,
Authorization: getToken(),
}, [
{
name: 'id', data: id,
},
]);
the following lines seems to be the problem:
'X-MOBILE-APP-VERSION': Config.APP_VERSION,
'X-MOBILE-APP-MARKET': Config.APP_MARKET,