Skip to main content

getContentType

@h4ad/serverless-adapter > getContentType

(function) getContentType

The function that returns the content type of headers

Signature:

export declare function getContentType(headers: BothValueHeaders): string;

Parameters

Parameter

Type

Description

headers

BothValueHeaders

The headers of the response

Returns:

string

Example

const headers = \{ 'content-type': 'application/json' };
const contentType = getContentType(headers);
console.log(contentType);
// application/json