Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Changed
- HTTP retries delay calculation to use exponential backoff strategy with jitter.
- HTTP retries condition to retry on axios timeout errors.
- http/https agents now use `keep-alive` by default.

## [5.5.4] - 2025-11-13
### Fixed
Expand Down
71 changes: 42 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,34 +119,31 @@ rpClient.checkConnect().then(() => {
| headers | Optional | {} | The object with custom headers for internal http client. |
| debug | Optional | false | This flag allows seeing the logs of the client. Useful for debugging. |
| isLaunchMergeRequired | Optional | false | Allows client to merge launches into one at the end of the run via saving their UUIDs to the temp files at filesystem. At the end of the run launches can be merged using `mergeLaunches` method. Temp file format: `rplaunch-${launch_uuid}.tmp`. |
| restClientConfig | Optional | Not set | `axios` like http client [config](https://github.com/axios/axios#request-config). Supports `proxy` and `noProxy` for proxy configuration (see [Proxy configuration](#proxy-configuration)), `agent` property for [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client options, `timeout`, `debug: true` for debugging, and `retry` property (number or [`axios-retry`](https://github.com/softonic/axios-retry#options) config) for automatic retries. |
| restClientConfig | Optional | Not set | Check the details in the [HTTP client config](#http-client-options). |
| launchUuidPrint | Optional | false | Whether to print the current launch UUID. |
| launchUuidPrintOutput | Optional | 'STDOUT' | Launch UUID printing output. Possible values: 'STDOUT', 'STDERR', 'FILE', 'ENVIRONMENT'. Works only if `launchUuidPrint` set to `true`. File format: `rp-launch-uuid-${launch_uuid}.tmp`. Env variable: `RP_LAUNCH_UUID`. |
| token | Deprecated | Not set | Use `apiKey` or `oauth` instead. |

## Asynchronous reporting
### HTTP client options

The client supports an asynchronous reporting (via the ReportPortal asynchronous API).
If you want the client to report through the asynchronous API, change `v1` to `v2` in the `endpoint` address.
`axios` like http client [config](https://github.com/axios/axios#request-config).

## API

Each method (except checkConnect) returns an object in a specific format:
```javascript
{
tempId: '4ds43fs', // generated by the client id for further work with the created item
promise: Promise // An object indicating the completion of an operation
}
```
The client works synchronously, so it is not necessary to wait for the end of the previous requests to send following ones.

### Timeout (30000ms) on axios requests
#### Timeout (30000ms) on axios requests

There is a timeout on axios requests. If for instance the server your making a request to is taking too long to load, then axios timeout will work and you will see the error 'Error: timeout of 30000ms exceeded'.

You can simply change this timeout by adding a `timeout` property to `restClientConfig` with your desired numeric value (in _ms_) or *0* to disable it.

### Retry configuration
#### Debug

Use `debug: true` for debugging.

#### Agent

Use `agent` property to provide [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) agent options.
Use this property in case the direct `httpAgent/httpsAgent` instance property cannot be used due to config serializations.

#### Retry configuration

The client retries failed HTTP calls up to 6 times with an exponential backoff (starting at 200 ms and capping at 5 s) and resets the axios timeout before each retry. Provide a `retry` option in `restClientConfig` to change that behaviour. The value can be either a number (overriding just the retry count) or a full [`axios-retry` configuration object](https://github.com/softonic/axios-retry#options):

Expand All @@ -166,13 +163,13 @@ const client = new RPClient({

Setting `retry: 0` disables automatic retries.

### Proxy configuration
#### Proxy configuration

The client supports comprehensive proxy configuration for both HTTP and HTTPS requests, including ReportPortal API calls and OAuth token requests. Proxy settings can be configured via `restClientConfig` or environment variables.

#### Basic proxy configuration
##### Basic proxy configuration

##### Via configuration object
###### Via configuration object

```javascript
const RPClient = require('@reportportal/client-javascript');
Expand All @@ -197,7 +194,7 @@ const rpClient = new RPClient({
});
```

##### Via proxy URL string
###### Via proxy URL string

```javascript
const rpClient = new RPClient({
Expand All @@ -208,7 +205,7 @@ const rpClient = new RPClient({
});
```

##### Via environment variables
###### Via environment variables

The client automatically detects and uses proxy environment variables:

Expand All @@ -218,7 +215,7 @@ export HTTP_PROXY=http://127.0.0.1:8080
export NO_PROXY=localhost,127.0.0.1,.local
```

#### Bypassing proxy for specific domains (noProxy)
##### Bypassing proxy for specific domains (noProxy)

Use the `noProxy` option to exclude specific domains from being proxied. This is useful when some services are accessible directly while others require a proxy.

Expand All @@ -245,7 +242,7 @@ const rpClient = new RPClient({

**Priority:** Configuration `noProxy` takes precedence over `NO_PROXY` environment variable.

#### Proxy with OAuth authentication
##### Proxy with OAuth authentication

When using OAuth authentication, the proxy configuration is automatically applied to both:
- OAuth token endpoint requests
Expand Down Expand Up @@ -273,17 +270,17 @@ const rpClient = new RPClient({
});
```

#### Advanced proxy scenarios
##### Advanced proxy scenarios

##### Disable proxy explicitly
###### Disable proxy explicitly

```javascript
restClientConfig: {
proxy: false // Disable proxy even if environment variables are set
}
```

##### Debug proxy configuration
###### Debug proxy configuration

Enable debug mode to see detailed proxy decision logs:

Expand All @@ -308,7 +305,7 @@ Debug output example:
Proxy URL: https://127.0.0.1:8080
```

#### Proxy configuration options
##### Proxy configuration options

| Option | Type | Description |
|---------------------|------------------------------|-------------------------------------------------------------------------------------------------|
Expand All @@ -321,14 +318,30 @@ Debug output example:
| `proxy.auth.password` | `string` | Proxy password |
| `noProxy` | `string` | Comma-separated list of domains to bypass proxy |

#### How proxy handling works
##### How proxy handling works

1. **Per-request proxy decision:** Each request (API or OAuth) determines its proxy configuration based on the target URL
2. **noProxy checking:** URLs matching `noProxy` patterns bypass the proxy and connect directly
3. **Default agents for bypassed URLs:** When a URL bypasses proxy, a default HTTP/HTTPS agent is used to prevent automatic proxy detection
4. **Environment variable support:** `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` are automatically detected and used if no explicit configuration is provided
5. **Priority:** Explicit configuration takes precedence over environment variables

## Asynchronous reporting

The client supports an asynchronous reporting (via the ReportPortal asynchronous API).
If you want the client to report through the asynchronous API, change `v1` to `v2` in the `endpoint` address.

## API

Each method (except checkConnect) returns an object in a specific format:
```javascript
{
tempId: '4ds43fs', // generated by the client id for further work with the created item
promise: Promise // An object indicating the completion of an operation
}
```
The client works synchronously, so it is not necessary to wait for the end of the previous requests to send following ones.

### checkConnect

`checkConnect` - asynchronous method for verifying the correctness of the client connection
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.5.4
5.5.5-SNAPSHOT
Loading
Loading