Forum Discussion

maxrussell's avatar
maxrussell
Contributor
4 years ago
Solved

Adding a default argument to requests

We are currently using a parameter $format. The default is to specify returning JSON. This can be left empty. If we want to add a notification to server to use a redirect, we have to add this to the...
  • richie's avatar
    richie
    4 years ago
    Hey maxrussell

    Yep the redirect query parm can also be setup as a project level property but theres a couple of things you need to be aware of.

    Query parms can br in any order....the endpoint doesnt care what sequence the query parms are in (i'll come back to this point).

    Can you confirm both the $format and $redirect query parms are always present what ever values they hold? That is, the presence of a query parameter is notswitcheable between test cases. You can set the parm to PLAIN (from QUERY to PLAIN) either at resource or method level and this will result in that query parm not appearing in the associTed teststeps that use request thats been setup. However, this will effect all teststeps that use this request within the project.

    To explain setting a parm to PLAIN If your URI query parms are as follows:
    ?$format=XML&$redirect

    Then $format is set as QUERY and $redirect is set as QUERY.

    If $redirect was set as PLAIN, your query parms in your URI would look like:
    ?$format=XML

    So. Can you confirm that the $redirect parm label is always present in your request?

    Can you confirm what values the $redirect parameter has?

    If you have an empty query parm e.g. as $format parm appears in the following example

    ?$format=&$redirect=yes

    Then the empty $format parm needs to go anywhere but the last parameter in the sequence. I cant quite remember but i think empty parms CANNOT be the last parm in the list. Trial and error will prove this out...im 95% positive about that.

    Typically you can store ANY REST parameter (URI or QUERY or MATRIX or HEADER) as properties which can be either project or testsuite or testcase or even at properties teststep level

    Ta

    Rich