Skip to content

Request options in test cases

Abhinav Asthana edited this page May 14, 2014 · 5 revisions

The request object available is now available in tests. The following properties are available on that object -

  • url: string - the final URL that the request is sent for
  • headers: object - Javascript object as a key-value pair
  • method: string - HTTP request method (GET/POST)
  • dataMode: string - One of raw, params and urlencoded
  • data: object - Javascript object as a key-value pair

All values in request.data are strings. For example, form data of name = 'foo' and age = 10 will give you a json object like so { name: 'foo', age: '10' }. Do remember to use a double equals ( == instead of ===) when testing integers or type cast them explicitly before using strong equality.