Sha256: f42308b75c7af020e8f893f7d0345afd81dedcfa0ce3a9e86bda553489a50967
Contents?: true
Size: 1.01 KB
Versions: 26
Compression:
Stored size: 1.01 KB
Contents
/** * @vitest-environment jsdom */ import { TextEncoder } from 'util' import { pruneGetRequestBody } from './pruneGetRequestBody' test('sets empty GET request body to undefined', () => { expect( pruneGetRequestBody({ method: 'GET', }), ).toBeUndefined() expect( pruneGetRequestBody({ method: 'GET', // There's no such thing as a GET request with a body. body: new ArrayBuffer(5), }), ).toBeUndefined() }) test('sets HEAD request body to undefined', () => { expect( pruneGetRequestBody({ method: 'HEAD', }), ).toBeUndefined() expect( pruneGetRequestBody({ method: 'HEAD', body: new ArrayBuffer(5), }), ).toBeUndefined() }) test('ignores requests of the other methods than GET', () => { const body = new TextEncoder().encode('hello world') expect( pruneGetRequestBody({ method: 'POST', body, }), ).toEqual(body) expect( pruneGetRequestBody({ method: 'PUT', body, }), ).toEqual(body) })
Version data entries
26 entries across 26 versions & 1 rubygems