Skip to content
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

Global request / response #2253

Merged
merged 2 commits into from
May 2, 2019
Merged

Global request / response #2253

merged 2 commits into from
May 2, 2019

Conversation

mrkurt
Copy link
Contributor

@mrkurt mrkurt commented Apr 30, 2019

This is a PR for #2108.

For context, these are ports of the Request and Response classes from github.com/superfly/fly

todo:

  • Request implementation + tests
  • Body mixin + tests
  • Response implementation + tests

to-maybe-do in a later PR:

  • Globals for streams: ReadableStream, WritableStream, TransformStream
  • refactor fetch.ts response implementation

@mrkurt mrkurt changed the title [WIP] Global request response Global request response Apr 30, 2019
@CLAassistant
Copy link

CLAassistant commented Apr 30, 2019

CLA assistant check
All committers have signed the CLA.

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.

Cool! Also add the new js and d.ts files to //cli/BUILD.gn (otherwise you'll get an appveyor error)

@kitsonk can you give this patch a review if you have time?

js/request_test.ts Show resolved Hide resolved
js/vendor/sd-streams.d.ts Outdated Show resolved Hide resolved
js/vendor/sd-streams.d.ts Outdated Show resolved Hide resolved
js/vendor/sd-streams.esm.js Outdated Show resolved Hide resolved
@mrkurt mrkurt changed the title Global request response Global request / response Apr 30, 2019
@mrkurt
Copy link
Contributor Author

mrkurt commented May 1, 2019

@kitsonk I added a new dependency to third_party and made a PR for it, it builds + passes when I use that branch: denoland/deno_third_party#43

package.json Show resolved Hide resolved
@ry
Copy link
Member

ry commented May 1, 2019

@mrkurt I pushed an update to third_party with your commit. Please change this to PR out of "draft mode" so travis runs. (I found the button to change it)

@ry ry marked this pull request as ready for review May 1, 2019 04:07
@ry
Copy link
Member

ry commented May 1, 2019

@mrkurt CI is stuck on lint. Run "tools/lint.py" to see the output:

node /Users/travis/build/denoland/deno/third_party/node_modules/eslint/bin/eslint --max-warnings=0 ./js/**/*.{ts,js} ./core/**/*.{ts,js} ./tests/**/*.{ts,js}
/Users/travis/build/denoland/deno/js/body_mixin.ts
   37:5   error    'validateBodyType' was used before it was defined  @typescript-eslint/no-use-before-define
   52:14  warning  Missing return type on function                    @typescript-eslint/explicit-function-return-type
   53:39  warning  Unexpected any. Specify a different type           @typescript-eslint/no-explicit-any
   99:32  warning  Unexpected any. Specify a different type           @typescript-eslint/no-explicit-any
  124:14  error    'bufferFromStream' was used before it was defined  @typescript-eslint/no-use-before-define
  138:1   warning  Missing return type on function                    @typescript-eslint/explicit-function-return-type
  138:34  warning  Unexpected any. Specify a different type           @typescript-eslint/no-explicit-any
  138:51  warning  Unexpected any. Specify a different type           @typescript-eslint/no-explicit-any
  168:22  warning  Missing return type on function                    @typescript-eslint/explicit-function-return-type
  172:6   warning  Missing return type on function                    @typescript-eslint/explicit-function-return-type
  175:15  warning  Missing return type on function                    @typescript-eslint/explicit-function-return-type
  177:28  error    'concatenate' was used before it was defined       @typescript-eslint/no-use-before-define
  193:16  warning  Missing return type on function                    @typescript-eslint/explicit-function-return-type
/Users/travis/build/denoland/deno/js/request_test.ts
  2:16  error  'assert' is defined but never used  @typescript-eslint/no-unused-vars
/Users/travis/build/denoland/deno/js/request.ts
   13:1   warning  Missing return type on function           @typescript-eslint/explicit-function-return-type
   14:38  warning  Missing return type on function           @typescript-eslint/explicit-function-return-type
   19:1   warning  Missing return type on function           @typescript-eslint/explicit-function-return-type
   61:24  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
   96:31  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  105:34  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  137:34  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
✖ 21 problems (4 errors, 17 warnings)

@mrkurt
Copy link
Contributor Author

mrkurt commented May 1, 2019

@ry Lint is passing now! Appveyor is not loving that submodule conflict though.

@ry
Copy link
Member

ry commented May 1, 2019

@mrkurt I squashed and force pushed to your branch. let's see if this works.

public credentials?: "omit" | "same-origin" | "include";
public headers: domTypes.Headers;

constructor(input: domTypes.RequestInfo, init?: domTypes.RequestInit) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not:
constructor(input: domTypes.RequestInfo, init: domTypes.RequestInit = {}) {
as
if (!init) { init = {}; }
follows?

u === "HEAD" ||
u === "OPTIONS" ||
u === "POST" ||
u === "PUT"
Copy link
Contributor

Choose a reason for hiding this comment

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

What about PATCH ?

@ry
Copy link
Member

ry commented May 1, 2019

@mrkurt Maybe fixed now. I pushed a change (and rebased again)

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 - we can do the response in another PR. Thanks!

@ry ry merged commit c05cbc8 into denoland:master May 2, 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