Comparing version 2.3.2 to 2.3.3
import { encodeBase64 } from "@oslojs/encoding"; | ||
import { OAuth2Tokens } from "./oauth2.js"; | ||
export function createOAuth2Request(endpoint, body) { | ||
const bodyBytes = new TextEncoder().encode(body.toString()); | ||
const request = new Request(endpoint, { | ||
method: "POST", | ||
body | ||
body: bodyBytes | ||
}); | ||
request.headers.set("Content-Type", "application/x-www-form-urlencoded"); | ||
request.headers.set("Accept", "application/json"); | ||
// Required by GitHub, and probably by others as well | ||
request.headers.set("User-Agent", "arctic"); | ||
// Required by Reddit | ||
request.headers.set("Content-Length", bodyBytes.byteLength.toString()); | ||
return request; | ||
@@ -12,0 +16,0 @@ } |
{ | ||
"name": "arctic", | ||
"type": "module", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "OAuth 2.0 clients for popular providers", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
116683
2657