@octokit/oauth-app
Advanced tools
Comparing version 3.4.0 to 3.5.0
@@ -68,3 +68,3 @@ 'use strict'; | ||
const VERSION = "3.4.0"; | ||
const VERSION = "3.5.0"; | ||
@@ -420,4 +420,15 @@ function addEventHandler(state, eventName, eventHandler) { | ||
}, request) { | ||
// request.url may include ?query parameters which we don't want for `route` | ||
if (request.method === "OPTIONS") { | ||
return { | ||
status: 200, | ||
headers: { | ||
"access-control-allow-origin": "*", | ||
"access-control-allow-methods": "*", | ||
"access-control-allow-headers": "Content-Type, User-Agent, Authorization" | ||
} | ||
}; | ||
} // request.url may include ?query parameters which we don't want for `route` | ||
// hence the workaround using new URL() | ||
const { | ||
@@ -452,3 +463,4 @@ pathname | ||
headers: { | ||
"content-type": "application/json" | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*" | ||
}, | ||
@@ -539,3 +551,4 @@ text: JSON.stringify({ | ||
headers: { | ||
"content-type": "application/json" | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*" | ||
}, | ||
@@ -564,3 +577,4 @@ text: JSON.stringify({ | ||
headers: { | ||
"content-type": "application/json" | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*" | ||
}, | ||
@@ -586,3 +600,4 @@ text: JSON.stringify(result) | ||
headers: { | ||
"content-type": "application/json" | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*" | ||
}, | ||
@@ -616,3 +631,4 @@ text: JSON.stringify(result) | ||
headers: { | ||
"content-type": "application/json" | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*" | ||
}, | ||
@@ -638,3 +654,4 @@ text: JSON.stringify(result) | ||
headers: { | ||
"content-type": "application/json" | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*" | ||
}, | ||
@@ -658,3 +675,6 @@ text: JSON.stringify(result) | ||
return { | ||
status: 204 | ||
status: 204, | ||
headers: { | ||
"access-control-allow-origin": "*" | ||
} | ||
}; | ||
@@ -674,3 +694,6 @@ } // route === routes.deleteGrant | ||
return { | ||
status: 204 | ||
status: 204, | ||
headers: { | ||
"access-control-allow-origin": "*" | ||
} | ||
}; | ||
@@ -681,3 +704,4 @@ } catch (error) { | ||
headers: { | ||
"content-type": "application/json" | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*" | ||
}, | ||
@@ -684,0 +708,0 @@ text: JSON.stringify({ |
// @ts-ignore - requires esModuleInterop flag | ||
import fromEntries from "fromentries"; | ||
export async function handleRequest(app, { pathPrefix = "/api/github/oauth" }, request) { | ||
if (request.method === "OPTIONS") { | ||
return { | ||
status: 200, | ||
headers: { | ||
"access-control-allow-origin": "*", | ||
"access-control-allow-methods": "*", | ||
"access-control-allow-headers": "Content-Type, User-Agent, Authorization", | ||
}, | ||
}; | ||
} | ||
// request.url may include ?query parameters which we don't want for `route` | ||
@@ -31,3 +41,6 @@ // hence the workaround using new URL() | ||
status: 400, | ||
headers: { "content-type": "application/json" }, | ||
headers: { | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*", | ||
}, | ||
text: JSON.stringify({ | ||
@@ -84,3 +97,6 @@ error: "[@octokit/oauth-app] request error", | ||
status: 201, | ||
headers: { "content-type": "application/json" }, | ||
headers: { | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*", | ||
}, | ||
text: JSON.stringify({ token, scopes }), | ||
@@ -99,3 +115,6 @@ }; | ||
status: 200, | ||
headers: { "content-type": "application/json" }, | ||
headers: { | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*", | ||
}, | ||
text: JSON.stringify(result), | ||
@@ -114,3 +133,6 @@ }; | ||
status: 200, | ||
headers: { "content-type": "application/json" }, | ||
headers: { | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*", | ||
}, | ||
text: JSON.stringify(result), | ||
@@ -131,3 +153,6 @@ }; | ||
status: 200, | ||
headers: { "content-type": "application/json" }, | ||
headers: { | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*", | ||
}, | ||
text: JSON.stringify(result), | ||
@@ -147,3 +172,6 @@ }; | ||
status: 200, | ||
headers: { "content-type": "application/json" }, | ||
headers: { | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*", | ||
}, | ||
text: JSON.stringify(result), | ||
@@ -160,3 +188,6 @@ }; | ||
}); | ||
return { status: 204 }; | ||
return { | ||
status: 204, | ||
headers: { "access-control-allow-origin": "*" }, | ||
}; | ||
} | ||
@@ -171,3 +202,6 @@ // route === routes.deleteGrant | ||
}); | ||
return { status: 204 }; | ||
return { | ||
status: 204, | ||
headers: { "access-control-allow-origin": "*" }, | ||
}; | ||
} | ||
@@ -177,3 +211,6 @@ catch (error) { | ||
status: 400, | ||
headers: { "content-type": "application/json" }, | ||
headers: { | ||
"content-type": "application/json", | ||
"access-control-allow-origin": "*", | ||
}, | ||
text: JSON.stringify({ error: error.message }), | ||
@@ -180,0 +217,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "3.4.0"; | ||
export const VERSION = "3.5.0"; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "3.4.0"; | ||
export declare const VERSION = "3.5.0"; |
{ | ||
"name": "@octokit/oauth-app", | ||
"description": "GitHub OAuth toolset for Node.js", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
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
146823
1679