http icon indicating copy to clipboard operation
http copied to clipboard

Params in wrong order (iOS only)

Open servusrene opened this issue 3 years ago • 4 comments

Describe the bug I am currently assembling parameters for an API request as follows:

    let params: HttpParams = {
        language: languageId.toString()
    };

    const articleIds = ['001111-00', '002222-00', '003333-00', '004444-00', '005555-00', '006666-00'];

    articleIds.forEach((id, index) => {
        if (index !== 0) {
            params['filter[' + index + '][operator]'] = '1';
        }

        params['filter[' + index + '][property]'] = 'id';
        params['filter[' + index + '][value]'] = id.toString();
    });

    const response = await Http.request({
        url: 'https://localhost/path/to/api/',
        params: params,
        method: 'GET'
    });

The parameters should then be passed to iOS in the following order: https://localhost/path/to/api/?language=1&filter[0][property]=id&filter[0][value]=%001111-00%&filter[1][operator]=1&filter[1][property]=id&filter[1][value]=%002222-00%&filter[2][operator]=1&filter[2][property]=id&filter[2][value]=%003333-00%&filter[3][operator]=1&filter[3][property]=id&filter[3][value]=%004444-00%&filter[4][operator]=1&filter[4][property]=id&filter[4][value]=%005555-00%&filter[5][operator]=1&filter[5][property]=id&filter[5][value]=%006666-00%

Unfortunately, this is on iOS not the case: first try: https://localhost/path/to/api/?filter[5][property]=id&filter[3][value]=%004444-00%&filter[2][operator]=1&filter[0][property]=id&filter[3][operator]=1&filter[2][value]=%003333-00%&filter[1][property]=id&filter[5][value]=%006666-00%&filter[4][property]=id&filter[2][property]=id&filter[3][property]=id&filter[4][value]=%005555-00%&filter[0][value]=%001111-00%&filter[1][operator]=1&language=2&filter[5][operator]=1&filter[4][operator]=1&filter[1][value]=%002222-00%

second try: https://localhost/path/to/api/?filter[2][operator]=1&language=2&filter[0][property]=id&filter[5][property]=id&filter[0][value]=%001111-00%&filter[2][property]=id&filter[4][value]=%005555-00%&filter[4][property]=id&filter[1][operator]=1&filter[5][value]=%006666-00%&filter[1][value]=%002222-00%&filter[3][property]=id&filter[3][value]=%004444-00%&filter[1][property]=id&filter[3][operator]=1&filter[4][operator]=1&filter[5][operator]=1&filter[2][value]=%003333-00%

Desktop:

  • OS: MacOS
  • Browser: Chrome
  • Version: 96.0.4664.45

Smartphone:

  • Device: iPhone 13 Pro
  • OS: iOS 15.1.1

servusrene avatar Nov 19 '21 15:11 servusrene

@mlynch @thomasvidas #push

servusrene avatar Nov 29 '21 07:11 servusrene

Faced the same issue with POST request, on a server side I'm receiving body randomly shuffled on each request.

razorbohan avatar Apr 28 '22 10:04 razorbohan

@mlynch @thomasvidas #push

servusrene avatar Jun 03 '22 09:06 servusrene

@jesperbjerke #push

servusrene avatar Jun 13 '22 11:06 servusrene