Skip to content

Conversation

@keroxp
Copy link
Contributor

@keroxp keroxp commented Feb 7, 2019

  • made acceptWebSocket, acceptable independent from ServerRequest
    • These are still compatible with existing code
  • made ServerRequest more stateless
  • add tests for acceptable
  • reformated

@ry
Copy link
Member

ry commented Feb 8, 2019

Looks good to me but CI is red.

@keroxp
Copy link
Contributor Author

keroxp commented Feb 8, 2019

@ry I found that test files that call runTests let tests failed if it is imported from test.ts...

@ry
Copy link
Member

ry commented Feb 8, 2019

@keroxp Yikes - not good.


import { Buffer } from "deno";
import { test, assert, assertEqual } from "../testing/mod.ts";
import { test, assert, assertEqual, runTests } from "../testing/mod.ts";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't have runTests?

Copy link
Contributor Author

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);
Copy link
Contributor

@MaxGraey MaxGraey Feb 8, 2019

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?

Copy link
Member

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.

@bartlomieju
Copy link
Member

@ry can we merge it? It'd like to continue #186 based on this PR.

Copy link
Member

@ry ry left a 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.

@ry ry merged commit 88ddd56 into denoland:master Feb 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants