@octokit/rest
Advanced tools
Comparing version 15.1.0 to 15.1.1
@@ -21,4 +21,8 @@ 'use strict' | ||
function restEndpoint (options) { | ||
// lowercase header names (#760) | ||
options.headers = mapKeys(options.headers, (value, key) => key.toLowerCase()) | ||
options = defaultsDeep({}, options, DEFAULTS) | ||
let method = options.method | ||
let method = options.method.toLowerCase() | ||
let baseUrl = options.baseUrl | ||
@@ -30,5 +34,2 @@ let url = options.url | ||
method = method.toLowerCase() | ||
headers = mapKeys(headers, (value, key) => key.toLowerCase()) | ||
// replace :varname with {varname} to make it RFC 6570 compatible | ||
@@ -35,0 +36,0 @@ url = url.replace(/:([a-z]\w+)/g, '{+$1}') |
module.exports = apiMethod | ||
const defaultsDeep = require('lodash/defaultsDeep') | ||
const mapKeys = require('lodash/mapKeys') | ||
@@ -8,2 +9,5 @@ const validate = require('./validate') | ||
function apiMethod (octokit, endpointDefaults, endpointParams, options, callback) { | ||
// lowercase header names (#760) | ||
options.headers = mapKeys(options.headers, (value, key) => key.toLowerCase()) | ||
const endpointOptions = defaultsDeep(options, endpointDefaults) | ||
@@ -10,0 +14,0 @@ |
@@ -60,3 +60,3 @@ 'use strict' | ||
if (!contentType || /^text\//.test(contentType)) { | ||
if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) { | ||
return response.text() | ||
@@ -63,0 +63,0 @@ } |
@@ -79,3 +79,3 @@ 'use strict' | ||
const contentType = response.headers['content-type'] | ||
const contentType = response.headers['content-type'] || '' | ||
@@ -88,3 +88,3 @@ if (data.length === 0) { | ||
if (contentType && contentType.indexOf('application/json') !== -1) { | ||
if (contentType.indexOf('application/json') !== -1) { | ||
return resolve({ | ||
@@ -96,3 +96,3 @@ meta: response.headers, | ||
if (contentType && /^text\//i.test(contentType)) { | ||
if (/^text\/|charset=utf-8$/i.test(contentType)) { | ||
return resolve({ | ||
@@ -99,0 +99,0 @@ meta: response.headers, |
{ | ||
"name": "@octokit/rest", | ||
"version": "15.1.0", | ||
"version": "15.1.1", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
565024
14770