Post

Replies

Boosts

Views

Activity

Reply to URL Encoding doesn't work with iOS 17 which is working with iOS 16
I'm using expo and react native and solved it using this method. If the ios version is 17 or higher, I force the axios request to ignore the urlencoding, and let the device do it. import { AxiosRequestConfig } from "axios"; import * as Device from 'expo-device'; const qs = require('qs'); const BROKEN_IOS_MAJOR_VERSION = 17; const osVersion = getDeviceVersion(); const isIos17OrNewer = Device.brand as DeviceBrand === DeviceBrand.Apple && osVersion as number >= BROKEN_IOS_MAJOR_VERSION; export const getAxiosRequest = ( request: AxiosRequestConfig<any> ): AxiosRequestConfig<any> => { return isIos17OrNewer ? { ...request, paramsSerializer: (params: any) => qs.stringify(params, { encode: false }), } : request }; Where request is the second argument in the axios.get method e.g. something like: { headers: { Authorization: 'bearer sometoken' }, params: { someKey: someValue }, } Hope this helps.
Dec ’23