mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
f513d59f69
* Add gRPC Headers (INS-362) (#3667) * Add grpc headers support to client, server and bidi streams * Fix failing grpc unit checks * Improvements after CR for #4244 * Fix lint issues * Fix grpc header overflow and failing tests * Fix illegal characters in metadata key validation * Fix common-headers naming and add unit checks * Fix wrong import format
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import allCharsets from '../../datasets/charsets';
|
|
import allMimeTypes from '../../datasets/content-types';
|
|
import allEncodings from '../../datasets/encodings';
|
|
import allHeaderNames from '../../datasets/header-names';
|
|
import { getCommonHeaderNames, getCommonHeaderValues } from '../common-headers';
|
|
|
|
describe('getCommonHeaderNames', () => {
|
|
it('should return common header names', () => {
|
|
expect(getCommonHeaderNames()).toBe(allHeaderNames);
|
|
});
|
|
});
|
|
|
|
describe('getCommonHeaderValues', () => {
|
|
it('should return mime types for accept', () => {
|
|
const header = {
|
|
name: 'Accept',
|
|
value: 'test',
|
|
};
|
|
expect(getCommonHeaderValues(header)).toEqual(expect.arrayContaining(allMimeTypes));
|
|
});
|
|
|
|
it('should return mime types for content-type', () => {
|
|
const header = {
|
|
name: 'Content-Type',
|
|
value: 'test',
|
|
};
|
|
expect(getCommonHeaderValues(header)).toEqual(expect.arrayContaining(allMimeTypes));
|
|
});
|
|
|
|
it('should return charsets for accept-charset', () => {
|
|
const header = {
|
|
name: 'Accept-Charset',
|
|
value: 'test',
|
|
};
|
|
expect(getCommonHeaderValues(header)).toEqual(expect.arrayContaining(allCharsets));
|
|
});
|
|
|
|
it('should return encodings for accept-encoding', () => {
|
|
const header = {
|
|
name: 'Accept-Encoding',
|
|
value: 'test',
|
|
};
|
|
expect(getCommonHeaderValues(header)).toEqual(expect.arrayContaining(allEncodings));
|
|
});
|
|
|
|
it('should return empty array for unknown header name', () => {
|
|
const header = {
|
|
name: 'Some-Header-Name',
|
|
value: 'test',
|
|
};
|
|
expect(getCommonHeaderValues(header)).toEqual(expect.arrayContaining([]));
|
|
});
|
|
});
|