OXYGEN
HomeGitHubReleasesCommunity
  • Welcome to Oxygen
  • About
    • What is Oxygen?
    • Getting Started (Videos)
      • Oxygen IDE Controls Overview
      • Recording a Web Test
      • Oxygen Commands Explained
    • Getting help
  • Download and work with Oxygen
    • Download & Installation
      • Oxygen IDE Installation
      • Oxygen for Mobile Installation
      • Oxygen for Windows Desktop Automation Setup
      • Oxygen for Mac Installation
        • Mac Installation Troubleshooting
      • Oxygen CLI Installation
      • Java Installation Instructions
      • Recording Troubleshooting
    • Start working with Oxygen
      • Getting Started - Web
        • Introduction - Web Testing
        • Recording a Web Test
        • Creating a Web Test
        • Sample Project - Web Test
      • Getting Started - Mobile
        • Introduction - Mobile Testing
        • Recording a Test on Mobile
        • Creating a Test - Mobile
        • Sample Project - Mobile
      • Getting Started - Oxygen for Windows Desktop Automation
      • Getting Started- Oxyge CLI
        • Running a Test Script on Windows
        • Running Multiple Tests (Suites) on Windows
    • Oxygen Modules
      • assert
      • date
      • db
      • email
      • eyes
      • http
      • log
      • mailinator
      • mob
      • pdf
      • proxy
      • serial
      • shell
      • soap
      • twilio
      • utils
      • web
      • win
    • Test Parameters
  • Cloud Providers
    • Sauce Labs
    • Lambda Test
    • TestObject
  • Advanced programming in Oxygen
    • Project Configuration
    • Locating Elements
    • Page Objects
    • Environments
    • Code Components
Powered by GitBook
On this page
  • assertCookie
  • assertHeader
  • assertResponseTime
  • assertStatus
  • assertStatusOk
  • assertText
  • delete
  • get
  • getResponse
  • getResponseBody
  • getResponseHeaders
  • getResponseUrl
  • patch
  • post
  • put
  • setNtlmUser
  • setOptions
  • setProxy
  • transaction

Was this helpful?

  1. Download and work with Oxygen
  2. Oxygen Modules

http

Provides methods for working with HTTP(S)

assertCookie

Assert if HTTP cookie is presented in the response

Parameters:

Name
Type
Description

cookieName

String

A HTTP cookie name.

cookieValuePattern

String

optional An optional HTTP cookie value pattern.

assertHeader

Assert if HTTP header is presented in the response

Parameters:

Name
Type
Description

headerName

String

A HTTP header name.

headerValuePattern

String

optional An optional HTTP header value pattern.

assertResponseTime

Assert response time

Parameters:

Name
Type
Description

maxTime

Number

Maximum response time in milliseconds.

assertStatus

Assert the last HTTP response's status code

Parameters:

Name
Type
Description

codeList

Number|Array

A single status code or a list of codes.

assertStatusOk

Assert HTTP 200 OK status

assertText

Assert whether the specified pattern is present in the response body.

Parameters:

Name
Type
Description

pattern

String

Pattern to assert.

delete

Performs HTTP DELETE

Parameters:

Name
Type
Description

url

String

URL.

headers

Object

optional HTTP headers.

data

Object

Data.

Returns:

Object - Response object.

get

Performs HTTP GET

** Usage example:**

// Basic usage example:
var response = http.get(
'https://api.github.com/repos/oxygenhq/oxygen-ide/releases', 
{
 'Accept-Encoding': 'gzip, deflate',
 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0'
});
log.info(response.body);

// If server returns Deflate-compressed stream without headers, `deflateRaw` can be used to decompress the content.
http.setOptions({
 deflateRaw: true
});
var response = http.get('https://FOO.BAR');
log.info(response.body);

Parameters:

Name
Type
Description

url

String

URL.

headers

Object

optional HTTP headers.

Returns:

Object - Response object.

getResponse

Returns last response object

Returns:

Object - Response object.

getResponseBody

Returns last response body

Returns:

String - Response body.

getResponseHeaders

Returns response headers

Returns:

Object - Response headers.

getResponseUrl

Returns response URL

Returns:

String - Response URL.

patch

Performs HTTP PATCH

Parameters:

Name
Type
Description

url

String

URL.

data

Object

Data.

headers

Object

optional HTTP headers.

Returns:

Object - Response object.

post

Performs HTTP POST

Parameters:

Name
Type
Description

url

String

URL.

data

Object

Data.

headers

Object

optional HTTP headers.

isFormData

Boolean

optional Indicates if "data" parameter is of URL-encoded form type.

Returns:

Object - Response object.

put

Performs HTTP PUT

Parameters:

Name
Type
Description

url

String

URL.

data

Object

Data.

headers

Object

optional HTTP headers.

Returns:

Object - Response object.

setNtlmUser

Sets user credentials for NTLM authentication process

Parameters:

Name
Type
Description

username

String

NTLM username.

password

String

NTLM password.

domain

String

optional NTLM domain name, if applicable.In addition to the options listed in the linked document, 'deflateRaw' option can be used when server returns Deflate-compressed stream without headers.

setOptions

Sets user defined HTTP options (such as proxy, decompress and etc.)

Parameters:

Name
Type
Description

opts

Object

setProxy

Sets proxy url to be used for connections with the service.

Parameters:

Name
Type
Description

url

String

Proxy server URL. Not passing this argument will reset the proxy settings.

transaction

Opens new transaction.

The transaction will persist till a new one is opened. Transaction names must be unique.

Parameters:

Name
Type
Description

name

String

The transaction name.

PreviouseyesNextlog

Last updated 8 months ago

Was this helpful?

HTTP request options object, see . In addition to the options listed in the linked document, 'deflateRaw' option can be used when server returns Deflate-compressed stream without headers.

Request Options