Menu
Open source
setBaseUrl( url )
Parameter | Type | Description |
---|---|---|
baseURL | string | Base URL to be used for all requests issued in the session |
Example
JavaScript
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx();
session.setBaseUrl('https://test-api.k6.io');
export default function () {
session.get('/public/crocodiles/1/'); // baseUrl doesn't need to be repeated on every request
}
Was this page helpful?
Related documentation
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video
Performance testing and observability in Grafana Cloud
In this webinar, learn how Grafana Cloud k6 offers you the best developer experience for performance testing.
User-centered observability: load testing, real user monitoring, and synthetics
Learn how to use load testing, synthetic monitoring, and real user monitoring (RUM) to understand end users' experience of your apps. Watch on demand.