1

I have situation like this:

* url address
    * header Authorization = 'Bearer ' + accessToken
    * configure ssl = true
    * path 'compliance' + '/accept'
    * param id = 10101016
    * def req = {"decision": <decision>, "reasonId": <reasonId>, "comment": <comment>}

    Given request req
    When method PUT
    Then status 200

resault: .../compliance/accept?id=10101016

And always my param go to end in url but I want this param between url like this: .../compliance?=id10101016/accept

How can I do this ? I am trying everythink but not working :/

I am looking answer on the internet but everywhere param go to the end of url.

MrMag1990
  • 33
  • 3

1 Answers1

0

First let me say that looks like a very badly designed API. Anyway you can do this:

* url 'https://httpbin.org/anything/compliance?=id10101016/accept'
* method get

And refer this for more details: https://stackoverflow.com/a/59977660/143475

And if you are worried about dynamic data, that's not a problem:

* def id = '10101016'
* url `https://httpbin.org/anything/compliance?=id${id}/accept`
* method get

I would think this is the right way:

* url 'https://httpbin.org/anything'
* path 'compliance?=id10101016', 'accept'
* method get

And yes, the ?= will get encoded, but that's how HTTP is supposed to work.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248