MCPcopy Index your code
hub / github.com/github-tools/github / __getRequestHeaders

Method __getRequestHeaders

lib/Requestable.js:91–107  ·  view source on GitHub ↗

* Compute the headers required for an API request. * @private * @param {boolean} raw - if the request should be treated as JSON or as a raw request * @param {string} AcceptHeader - the accept header for the request * @return {Object} - the headers to use in the request

(raw, AcceptHeader)

Source from the content-addressed store, hash-verified

89 * @return {Object} - the headers to use in the request
90 */
91 __getRequestHeaders(raw, AcceptHeader) {
92 let headers = {
93 'Content-Type': 'application/json;charset=UTF-8',
94 'Accept': 'application/vnd.github.' + (AcceptHeader || this.__AcceptHeader),
95 };
96
97 if (raw) {
98 headers.Accept += '.raw';
99 }
100 headers.Accept += '+json';
101
102 if (this.__authorizationHeader) {
103 headers.Authorization = this.__authorizationHeader;
104 }
105
106 return headers;
107 }
108
109 /**
110 * Sets the default options for API requests

Callers 1

_requestMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected