1.0.1 • Published 6 years ago

codeceptjs-axios v1.0.1

Weekly downloads
57
License
MIT
Repository
github
Last release
6 years ago

codeceptjs-axios

codeceptjs-http is CodeceptJS helper which wraps axios library to perform requests. It's alternative helper that provides more flexible request management.

Configuration

This helper should be configured in codecept.json/codecept.conf.js

  • baseURL: base HTTP url.

Example:

{
   "helpers": {
     "AXIOS" : {
       "require": "codeceptjs-axios",
       "baseURL": "http://localhost:8080"
     }
   }
}

sendGetRequest

Send HTTP request, response will be availible as return value.

I.sendGetRequest('/api/users.json');

Parameters

  • url - endpoint path. Can be relative or absolute
  • headers - (optional) to include token in the headers for example

sendPostRequest

Send HTTP request, response will be availible as return value.

I.sendPostRequest('/api/users.json', { "email": "user@user.com" });

Parameters

  • url - endpoint path. Can be relative or absolute
  • payload - the request body to send
  • headers - (optional) to include token in the headers for example

sendPatchRequest

Send HTTP request, response will be availible as return value.

I.sendPatchRequest('/api/users.json', { "email": "user@user.com" });

Parameters

  • url - endpoint path. Can be relative or absolute
  • payload - the request body to send
  • headers - (optional) to include token in the headers for example

sendPutRequest

Send HTTP request, response will be availible as return value.

I.sendPutRequest('/api/users.json', { "email": "user@user.com" });

Parameters

  • url - endpoint path. Can be relative or absolute
  • payload - the request body to send
  • headers - (optional) to include token in the headers for example

sendDeleteRequest

Send HTTP request, response will be availible as return value.

I.sendDeleteRequest('/api/users/1');

Parameters

  • url - endpoint path. Can be relative or absolute
  • headers - (optional) to include token in the headers for example
1.0.1

6 years ago

1.0.0

6 years ago