Skip to content

Conversation

@coolaj86
Copy link
Member

@coolaj86 coolaj86 commented Mar 24, 2023

Multiple issues

Fix Error Handling

Need to await because fetch.

Need .text() rather than .json() because .text() will (almost) always succeed, and errors are often of a nature such that they don't come back as JSON.

Hmm.... actually my goal there originally was to JSONify the response object:

{ ok, headers, ... }

I think we'd still have to pull that out of the old @root/request.js because fetch is... still so non-standard, non-js-ish...

TODO To-Done

    let headers = Object.fromEntries(resp.headers.entries());
    let body = await resp.text();
    err.response = {
      ok: resp.ok,
      status: resp.status,
      headers: headers,
      body: body,
    };

@coolaj86 coolaj86 force-pushed the fix-await-error-text branch from 4b09fc1 to 56f623a Compare March 26, 2023 09:05
@coolaj86 coolaj86 changed the title fix: await error response, and as text fix: unbreak node, undo API changes Mar 26, 2023
@coolaj86
Copy link
Member Author

@jojobyte Will you test these changes in CrowdNode and wherever else you were using this?

@coolaj86 coolaj86 force-pushed the fix-await-error-text branch from 524fa7e to 1874927 Compare March 26, 2023 09:23
@dashhive dashhive deleted a comment from socket-security bot Mar 26, 2023
@socket-security
Copy link

New dependency changes detected. Learn more about Socket for GitHub ↗︎


👍 No new dependency issues detected in pull request

Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore [email protected] bar@* or ignore all packages with @SocketSecurity ignore-all

Pull request alert summary
Issue Status
Install scripts ✅ 0 issues
Native code ✅ 0 issues
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues

📊 Modified Dependency Overview:

➕ Added Package Capability Access +/- Transitive Count Publisher
[email protected] network, environment +0 lpinca
[email protected] None +6 awaterma

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.

2 participants