-
Notifications
You must be signed in to change notification settings - Fork 661
refactor: make acceptWebSocket independent from ServerRequest #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Looks good to me but CI is red. |
|
@ry I found that test files that call |
|
@keroxp Yikes - not good. |
http/server_test.ts
Outdated
|
|
||
| import { Buffer } from "deno"; | ||
| import { test, assert, assertEqual } from "../testing/mod.ts"; | ||
| import { test, assert, assertEqual, runTests } from "../testing/mod.ts"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't have runTests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ry Yes, removed.
| const end = encoder.encode("\r\n"); | ||
| await writer.write(start); | ||
| await writer.write(chunk); | ||
| await writer.write(end); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using copyBytes with one write?
await writer.write(
copyBytes(
copyBytes(
copyBytes(start, chunk), end
),
endChunk
)
);also end and endChunk could be concatenated before encode
Or this parts should be always flushed separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to flush separately. copyBytes will allocate new buffers which would be wasteful.
ry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - sorry for the delay.
acceptWebSocket,acceptableindependent fromServerRequestServerRequestmore statelessacceptable