Send empty array with array encoding

1 week ago 5
ARTICLE AD BOX

In my Swift iOS project, I need to send an empty array as parameter in my Alamofire API request. As encoding method, I have to use:

encoding: URLEncoding(arrayEncoding: .indexInBrackets)

When I check my parameters field which is sent in this PUT request, it properly shows the empty array:

{ my_array: [], x: "a", y: "b", ... }

But when I check the response to see what encoded request parameters were sent, it doesn't show up:

(lldb) po response.request.httpBody (lldb) x=a&y=b

(simplified console output for readability)

How can I make sure the empty array is sent?
Again, I cannot use JSONEncoding.default because the API doesn't allow it.

I know there are similar questions out there, but none where arrayEncoding is used.

Read Entire Article