xmljsonerlangtsungerl

Sending json with tsung POST request


I'm trying to create a POST request with Tsung

<request> 
  <http url="api.whatever.com" method="POST" version="1.1" contents=""></http>
</request>

How can I send a JSON document in the contents attribute?

contents='{"name": "alex"}' 

is of course invalid...

Is there a way I can send JSON with my POST request?


Solution

  • I was able to do this by replacing " &quot; and adding the content type header application/json

    So my example would become:

    content_type='application/json' contents='{&quot;name&quot;: &quot;alex&quot;}