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

feat(compat): support got #4395

Closed
wants to merge 29 commits into from
Closed

feat(compat): support got #4395

wants to merge 29 commits into from

Conversation

paperdave
Copy link
Member

@paperdave paperdave commented Aug 29, 2023

What does this PR do?

I got got working.

Closes #3150

  • Allow setting req.statusMessage (it is a no-op, which is fine for supporting got, as they do = req.statusMessage ?? http.STATUS_CODES[req.status] which is already what we set it to.
  • Fix newListeners in native EE to emit before the listener is added.
  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

How did you verify your code works?

Tests for both individual fixes.

@Electroid
Copy link
Contributor

@paperdave We should add a basic test(s) that include got so we know if there's a regression in the future

@github-actions
Copy link
Contributor

github-actions bot commented Aug 29, 2023

✅ test failures on linux-x64-baseline have been resolved.

#9b45ff8dec735873ed8d58b3ef4b4c2a996f7d9d

@github-actions
Copy link
Contributor

github-actions bot commented Aug 29, 2023

✅ test failures on linux-x64 have been resolved.

#9b45ff8dec735873ed8d58b3ef4b4c2a996f7d9d

@github-actions
Copy link
Contributor

github-actions bot commented Aug 29, 2023

@cirospaciari 5 files with test failures on bun-darwin-aarch64:

  • test/integration/next/default-pages-dir/test/dev-server.test.ts
  • test/js/bun/spawn/spawn-streaming-stdin.test.ts
  • test/js/bun/test/test-test.test.ts
  • test/js/bun/util/which.test.ts
  • test/js/web/worker.test.ts

View test output

#9b45ff8dec735873ed8d58b3ef4b4c2a996f7d9d

@github-actions
Copy link
Contributor

github-actions bot commented Aug 29, 2023

@cirospaciari 6 files with test failures on bun-darwin-x64-baseline:

  • test/js/bun/spawn/spawn-streaming-stdout.test.ts
  • test/js/bun/util/which.test.ts
  • test/js/node/fs/fs.test.ts
  • test/js/node/watch/fs.watchFile.test.ts
  • test/js/third_party/webpack/webpack.test.ts
  • test/js/web/timers/setTimeout.test.js

View test output

#9b45ff8dec735873ed8d58b3ef4b4c2a996f7d9d

@sirenkovladd
Copy link
Contributor

I think, also need tests with https

@sirenkovladd
Copy link
Contributor

sirenkovladd commented Aug 30, 2023

test("https gzip", async () => {
    const stream = await got('https://bun.sh/', {
      headers: {
        'Accept-Encoding': 'gzip',
      }
    });
    expect(stream.statusCode).toBe(200);
  });

@paperdave paperdave marked this pull request as draft August 31, 2023 00:31
@paperdave
Copy link
Member Author

the https test does not work and blocks this. looking into it

cirospaciari and others added 2 commits November 27, 2023 18:04
* Rename http_client_async -> http

* Delete bun_dev_http_server.zig

* update these

* [uws] Add method for getting SO_ERROR

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
james-elicx and others added 15 commits November 27, 2023 18:07
* Environment variables

* .
* fix: only write header if not exist

If user set header by himself, then we not write duplicate header.

* feat: add test to check header

* chore: format code
* WIP

* native oneshot sign

* add native verify

* fallback rsa to non-native

* WIP der dsaEncoding

* pass encoding

* RSA-PSS padding and saltLength

* oopies

* improve RSA-PSS support

* accepts hash identifiers like nodejs and add options.hashAlgorithm support

* fix string check

* tests

* define hash for ECDSA

* fix compilation
* Implement `fs.readdir(path, {recursive: true})` and `fs.readdirSync(path, {recursive: true})`

* Update node_fs.zig

* FIx memory leak in error code

* Add fail test

* Update readdir.mjs

* Update bun.zig

* Update readdir.mjs

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
* Add `import.meta.env` to `bun-types`

* add type to codeblock
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
* Clean up lifetime handling for `napi_create_string_utf16` and `napi_create_string_latin1`

* Fix `napi_create_arraybuffer`

* Update globals.d.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
…7320)

* feat(test): `toHaveBeenNthCalledWith` + improve some fail messages

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
@z0rrn
Copy link

z0rrn commented Feb 25, 2024

Any update on this? I know it's a bad question but got alone has 8.000 dependents.

@prabhu
Copy link

prabhu commented May 28, 2024

Latest error with got 14.3.0

767 |             const cacheRequest = cacheableStore.get(options.cache)(options, async (response) => {
768 |                 response._readableState.autoDestroy = false;
769 |                 if (request) {
770 |                     const fix = () => {
771 |                         if (response.req) {
772 |                             response.complete = response.req.res.complete;
                                                      ^
TypeError: undefined is not an object (evaluating 'response.req.res.complete')
      at fix (/home/runner/work/cdxgen/cdxgen/node_modules/got/dist/source/core/index.js:772:49)
      at /home/runner/work/cdxgen/cdxgen/node_modules/got/dist/source/core/index.js:776:21
      at /home/runner/work/cdxgen/cdxgen/node_modules/got/dist/source/core/index.js:767:84
      at /home/runner/work/cdxgen/cdxgen/node_modules/cacheable-request/dist/index.js:148:25
      at handler (/home/runner/work/cdxgen/cdxgen/node_modules/cacheable-request/dist/index.js:77:40)
      at node:http:930:191

@panga
Copy link

panga commented Jun 24, 2024

Are there any update on this?

@paperdave paperdave deleted the got branch October 29, 2024 01:02
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.

the Got library not work with Bun