Skip to content

Commit b1a35b5

Browse files
committed
cleanup
1 parent 13b486d commit b1a35b5

File tree

6 files changed

+267
-76
lines changed

6 files changed

+267
-76
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@types/ws": "^8.5.10",
3939
"@typescript-eslint/eslint-plugin": "^6.19.0",
4040
"@typescript-eslint/parser": "^6.19.0",
41-
"@vitest/coverage-v8": "^1.2.1",
41+
"@vitest/coverage-istanbul": "^3.0.5",
4242
"abort-controller": "^3.0.0",
4343
"eslint": "^8.56.0",
4444
"eslint-config-prettier": "^9.1.0",

src/fetchCompat.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,13 @@ function createHeaders(req: HttpRequest): Headers {
7272
const headers = new Headers();
7373

7474
req.forEach((key, value) => {
75-
if (typeof key === 'string' && key.startsWith(':')) {
75+
/* istanbul ignore next -- @preserve */
76+
if (key.startsWith(':')) {
7677
// Skip HTTP/2 pseudo-headers
7778
return;
7879
}
7980

80-
if (Array.isArray(value)) {
81-
for (const item of value) {
82-
headers.append(key, item);
83-
}
84-
} else if (value != null) {
81+
if (value.length != 0) {
8582
headers.append(key, value);
8683
}
8784
});

src/server.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ import {
4040
import { applyWebsocketHandler, CreateWSSContextFnOptions } from './websockets';
4141
import { TRPCRequestInfo } from '@trpc/server/http';
4242

43-
export function sleep(ms = 0): Promise<void> {
44-
return new Promise<void>((res) => setTimeout(res, ms));
45-
}
46-
4743
const config = {
4844
prefix: '/trpc',
4945
};

src/websockets.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ import {
5656
} from '@trpc/server/observable';
5757
import { URL } from 'url';
5858

59-
// TODO: ask TRPC to expose these
60-
// import { iteratorResource } from '@trpc/server/src/unstable-core-do-not-import/stream/utils/asyncIterable';
61-
// import { Unpromise } from '@trpc/server/src/vendor/unpromise';
6259
// copying over packages/server/src/adapters/ws.ts
6360

6461
export type WebSocketConnection = WebSocket<WebsocketData>;

vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default defineConfig({
1212
coverage: {
1313
provider: 'istanbul',
1414
include: ['**/src/**'],
15-
exclude: [],
15+
exclude: ['**/src/**.spec.ts'],
1616
},
1717
poolOptions: {
1818
threads: {

0 commit comments

Comments
 (0)