Skip to content

Commit

Permalink
Fix for CORS issue and updated typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
dopecodez committed Jun 26, 2022
1 parent 689fdf6 commit b9bd6fa
Show file tree
Hide file tree
Showing 5 changed files with 719 additions and 900 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"eslint-plugin-tsdoc": "^0.2.7",
"jest": "^26.6.1",
"ts-jest": "^26.4.3",
"typescript": "^3.8.3"
"typescript": "^4.4.4"
},
"files": [
"dist"
Expand Down
4 changes: 2 additions & 2 deletions source/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function makeRequest(params: any, redirect = true): Promise<any> {
search['origin'] = '*';
const options: RequestInit = {
headers: {
'User-Agent': USER_AGENT,
'Api-User-Agent': USER_AGENT,
}
}
let searchParam = '';
Expand All @@ -44,7 +44,7 @@ export async function makeRestRequest(path: string, redirect = true): Promise<an
}
const options: RequestInit = {
headers: {
'User-Agent': USER_AGENT
'Api-User-Agent': USER_AGENT
}
}
const response = await fetch(encodeURI(REST_API_URL + path), options);
Expand Down
2 changes: 1 addition & 1 deletion test/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const apiUrl = "https://en.wikipedia.org/w/api.php?";
const restApiUrl = 'https://en.wikipedia.org/api/rest_v1/';
const options: RequestInit = {
headers: {
'User-Agent': 'wikipedia (https://github.com/dopecodez/Wikipedia/)'
'Api-User-Agent': 'wikipedia (https://github.com/dopecodez/Wikipedia/)'
}
}

Expand Down
51 changes: 26 additions & 25 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
{
"compilerOptions": {
"outDir": "dist",
"target": "es2018", // Node.js 10
"lib": [
"es2018"
],
"types" : [ "node", "jest" ],
"strict": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true,
"module": "commonjs",
"moduleResolution": "node",
"declaration": true
},
"include": [
"source"
],
"typedocOptions": {
"exclude": ["**/node_modules/**"],
"mode": "modules",
"out": "docs"
}
{
"compilerOptions": {
"outDir": "dist",
"target": "es2018", // Node.js 10
"lib": [
"es2018"
],
"types" : [ "node", "jest" ],
"strict": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true,
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"useUnknownInCatchVariables": false
},
"include": [
"source"
],
"typedocOptions": {
"exclude": ["**/node_modules/**"],
"mode": "modules",
"out": "docs"
}
}
Loading

0 comments on commit b9bd6fa

Please sign in to comment.