Skip to content

Commit

Permalink
add some suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
KonnorRogers committed Dec 1, 2022
1 parent 7be35e2 commit 80c197f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
2 changes: 0 additions & 2 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ export type ProcessStats = {

export type TransportOptions = {
method: 'GET' | 'POST',
// @TODO: This should probably follow the fetch "HeadersInit"
// headers?: HeadersInit
headers?: Record<string, number | string | string[] | undefined>,
endpoint: string,
maxObjectDepth?: number,
Expand Down
2 changes: 1 addition & 1 deletion packages/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"scripts": {
"build": "tsc --build tsconfig.json && rollup -c && node ./scripts/copy-typedefs.js",
"test": "npm run test:browser && npm run test:server && npm run tsd",
"test:browser": "jest --env=jsdom --setupFiles=\"<rootDir>/jest-browser-setup.js\" --testPathPattern=\"test/unit/.*(?<![\\./]server)\\.test\\.(js|ts)\"",
"test:browser": "jest --env=jsdom --setupFiles=\"<rootDir>/test/unit/jest-browser-setup.js\" --testPathPattern=\"test/unit/.*(?<![\\./]server)\\.test\\.(js|ts)\"",
"test:server": "jest --env=node --testPathPattern=\"test/unit/.*(?<![\\./]browser)\\.test\\.(js|ts)\"",
"test:integration": "test/integration/node_modules/karma/bin/karma start test/integration/karma.conf.js",
"test:integration:browserstack": "npm run test:integration",
Expand Down
10 changes: 3 additions & 7 deletions packages/js/src/browser/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@ export class BrowserTransport implements Types.Transport {
requestInit.body = payload ? JSON.stringify(sanitize(payload, options.maxObjectDepth)) : undefined
}

try {
const response = await globalThisOrWindow().fetch(options.endpoint, requestInit)
const response = await globalThisOrWindow().fetch(options.endpoint, requestInit)

const body = await response.text()
const body = await response.text()

return Promise.resolve({ statusCode: response.status, body })
} catch (err) {
return Promise.reject(err)
}
return Promise.resolve({ statusCode: response.status, body })
}
}
File renamed without changes.

0 comments on commit 80c197f

Please sign in to comment.