Search code examples
testingpostman

How to retrieve body form-data in key value pair and use it in postman test script


request body form-data

I tried the following but didnot work pm.request.body.data

pm.request.data


Solution

  • Access this format

    pm.request.body.formdata.get("name")
    pm.request.body.formdata.get("last_name")
    pm.request.body.formdata.get("other_name")
    

    Documentation in here

    formdata :PropertyList.<FormParam>
    Form data parameters for this request are held in this field.
    
    Type:
    PropertyList.<FormParam>
    

    enter image description here

    Usage in Tests tab.

    enter image description here