Closed geseq closed 6 years ago
Added tests wrt #71 but I will write additional tests separately.
@earncef Could give this a rebase?
Done
I agree. What would you consider the case for error though? Not being one of "" or "[]" or "[I]"?
@Hanzei any update on the last commit?
I agree. What would you consider the case for error though? Not being one of "" or "[]" or "[I]"?
Correct. I would limit SetURLValuesSliceKeySuffix
to these three values and throw an error for every other.
Done
Certain APIs (I believe those written in PHP) seem to be unable to parse correctly URLQuery() result containing slices generated by URLValuesSliceKeySuffix="" or URLValuesSliceKeySuffix="[]".
The solution is to pass the slices with an index so that they are read correctly.
For instance, in order to parse slices of the form correctly: objx.Map{"mapSlice": []objx.Map{objx.Map{"age": 40, "sex": "male"}, objx.Map{"height": 152}}} the query needs to be: mapSlice[0][age]=40&mapSlice[0][sex]=male&mapSlice[1][height]=152
Currently these two forms are possible which don't work: mapSlice[age]=40&mapSlice[sex]=male&mapSlice[height]=152 mapSlice[][age]=40&mapSlice[][sex]=male&mapSlice[][height]=152
I've modified the code to check for URLValuesSliceKeySuffix="[i]" and use slice indexes when present