insomnia/packages/insomnia-app/app/common/common-headers.ts
Filipe Freire f513d59f69
Add gRPC Headers (INS-362) (#3667) (#4244)
* 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
2021-12-06 10:12:18 +00:00

28 lines
667 B
TypeScript

import allCharsets from '../datasets/charsets';
import allMimeTypes from '../datasets/content-types';
import allEncodings from '../datasets/encodings';
import allHeaderNames from '../datasets/header-names';
import { RequestHeader } from '../models/request';
export const getCommonHeaderValues = (pair: RequestHeader): any[] => {
switch (pair.name.toLowerCase()) {
case 'content-type':
case 'accept':
return allMimeTypes;
case 'accept-charset':
return allCharsets;
case 'accept-encoding':
return allEncodings;
default:
return [];
}
};
export const getCommonHeaderNames = (): any[] => {
return allHeaderNames;
};