Rayrun
← Back to Discord Forum

Sending a API POST

When I try to send a post I keep getting an error request.post is not a function. Here is the function I have created that im trying to use

async addChildOrganization(newOrg, parentOrg, request, authToken, bodyUrl) {
        const response = await request.post(
            this.addOrganizationUrl, {
                headers: { Authorization: `bearer ${authToken}`, 'x-organization': 'testing', contentType: 'application/json' },
                data: {
                    id: newOrg,
                    parent: parentOrg,
                    orgname: newOrg,
                    logoURL: bodyUrl
                },
            })
        return response
    }

The body im sending needs to be in a JSON format , Any help would be much appreciated

This thread is trying to answer question "Why am I getting an error 'request.post is not a function' when trying to send a POST request?"

0 replies

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.