Importing http from k6/http does not work

I have searched through the documentation and this forum, but wasn’t able to find anything related.

This might be either the strangest thread here ever, or I am losing my mind. :slight_smile: Let’s keep the long code/story short and just say that the following code logs ‘undefined’ for me:

import http from 'k6/http';

As the result, all http-related methods are out of reach. :frowning:

Rest assured, k6/http exists and should function properly. Here’s the excerpt of what I have there:

declare namespace http {
     * Make DELETE  request.
     * @param url - Request URL.
     * @param body - Discouraged. Request body. Object form encoded.
     * @param params - Request parameters.
     * @returns Resulting response.
    function del<RT extends ResponseType | undefined>(
        url: string | HttpURL,
        body?: RequestBody | null,
        params?: RefinedParams<RT> | null
    ): RefinedResponse<RT>;

So, what I am doing wrong?

Thank you for your time.

1 Like

This is solved. I should have used the following import:

import * as http from 'k6/http';
1 Like