stubby4node icon indicating copy to clipboard operation
stubby4node copied to clipboard

Attribute name with brackets - Error 404

Open Lukeneo12 opened this issue 5 years ago • 2 comments

Hi guys, how are you?

I'm trying to do this:

- request:
    url: ^/example/path
    method: POST
    post: next_page=1111&state[]=2&city[]=3
    headers:
      content-type: application/x-www-form-urlencoded
  response:
    body: {"status": "success"}
    status: 200

But when i do the petition i get a 404. If i remove the brackets from state and city, it works perfectly. I also try to scape the characters with regexp:

-request:
    url: ^/example/path
    method: POST
    post: next_page=1111&state\[\]=2&city\[\]=3
    headers:
      content-type: application/x-www-form-urlencoded
  response:
    body: {"status": "success"}
    status: 200

Not working either.

Let me know if there is some workaround or if you are gonna make a release with this. I also see in your docs that you have a TODO about allowing array/maps in query/post: https://www.npmjs.com/package/stubby#todo

Best regards!

Lukeneo12 avatar Jan 21 '20 20:01 Lukeneo12

Is the client is sending those ~query~ form params with the brackets?

mrak avatar Jan 21 '20 22:01 mrak

Yes, the client is sending them.

Lukeneo12 avatar Jan 22 '20 20:01 Lukeneo12