reactjs - ReactNative case sensitivity ignored when sending custom headers through fetch request -
i using react native 0.23.1 (also tried using 29) on mac. during fetch request react ios, when send custom header (eg 'api-version' : '0.1' ) server receives in lower case ('api-version':'0.1').the standard of writing header using camel case, don't have control on server code request fails expecting headers in camelcase.when checking server log found out other non custom headers come camel case while custom headers come lowercase.
i tried using different http clients such frisbee , axios still same.
doing same request using chrome console successful.
following fetch code
fetch(properties.uris.base + properties.uris.getbusinessdetails.replace("{businessid}", properties.appid).replace("{timezone",this.gettimezone()), { method: "get", headers: { 'accept': 'application/json', 'content-type': 'application/json', 'user-agent': deviceinfo.getuseragent(), 'x-userid':userdetailsjson.username, 'x-businessid':properties.appid, 'x-app-version': deviceinfo.getversion(), 'api-version': properties.fetchheaderinformation.apiversion, }}) .then((response) => response.json())
i had fork fetch repo github , did alteration, used on react native project
Comments
Post a Comment