Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
Replace request library with undici
Browse files Browse the repository at this point in the history
The [request](https://www.npmjs.com/package/request) library has been deprecated for some time. This change:

1. Replaces use of request (the library) with the `request` function from [undici](https://github.com/nodejs/undici), which has been adopted by Node to provide an implementation of the now-standard [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) web API. This `request` API is almost but not quite identical to `fetch`, but undici's `fetch` is not available for some of our currently supported Node versions.

2. Refactors the three very similar dev-facing API endpoints provided by enketo-transformer's `app.js`. This isn't strictly necessary but it was easier to reason about than applying the same changes repeatedly, and...

3. ... caught/fixed a bug where the POST handler always returned a 400 Bad Request for valid POST bodies with an `xform` property.
  • Loading branch information
eyelidlessness committed Dec 8, 2022
1 parent 100e171 commit e6c5840
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 424 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"plugins": ["chai-friendly", "jsdoc", "prettier", "unicorn"],
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2019
"ecmaVersion": 2020
},
"settings": {
"jsdoc": {
Expand Down
Loading

0 comments on commit e6c5840

Please sign in to comment.