Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@japa/api-client

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@japa/api-client

Browser and API testing client for Japa. Built on top of Playwright

  • 2.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20K
increased by2.3%
Maintainers
0
Weekly downloads
 
Created
Source

@japa/client

API client to test endpoints over HTTP. Uses superagent under the hood

github-actions-image npm-image license-image typescript-image

The API client plugin of Japa makes it super simple to test your API endpoints over HTTP. You can use it to test any HTTP endpoint that returns JSON, XML, HTML, or even plain text.

It has out of the box support for:

  • Multiple content types including application/json, application/x-www-form-urlencoded and multipart.
  • Ability to upload files.
  • Read and write cookies with the option to register custom cookies serializer.
  • Lifecycle hooks. A great use-case of hooks is to persist and load session data during a request.
  • All other common abilities like sending headers, query-string, and following redirects.
  • Support for registering custom body serializers and parsers.
Complete API documentation

Installation

Install the package from the npm registry as follows:

npm i @japa/api-client

yarn add @japa/api-client

Usage

You can use the assertion package with the @japa/runner as follows.

import { apiClient } from '@japa/api-client'
import { configure } from '@japa/runner'

configure({
  plugins: [apiClient({ baseURL: 'http://localhost:3333' })]
})

Once done, you will be able to access the client property from the test context.

test('test title', ({ client }) => {
  const response = await client.get('/')
})

Keywords

FAQs

Package last updated on 20 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc