Skip to content

Commit

Permalink
Merge pull request #5 from shgysk8zer0/patch/consts
Browse files Browse the repository at this point in the history
Update modules and constants
  • Loading branch information
shgysk8zer0 authored Sep 26, 2023
2 parents 5c2b461 + f805e59 commit 5c77547
Show file tree
Hide file tree
Showing 10 changed files with 407 additions and 112 deletions.
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v1.0.1] - 2023-09-24
## [v1.0.2] - 2023-09-25

### Deprecated
- Deprecated `parseMultipartFormData()` due to [ReDoS issue](https://github.com/shgysk8zer0/node-http/issues/2)
### Added
- Install and use `@shgysk8zer0/consts`
- Export all modules as CommonJS in `/cjs/`

### Fixed
- Fix `imports` in `package.json` to work with `@shgysk8zer0/http/module` as well as `@shgysk8zer0/http/module.js`

## [v1.0.1] - 2023-09-24

### Deprecated
- Deprecated `parseMultipartFormData()` due to [ReDoS issue](https://github.com/shgysk8zer0/node-http/issues/2)

## [v1.0.0] - 2023-09-22

Initial Release
2 changes: 1 addition & 1 deletion error.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { INTERNAL_SERVER_ERROR } from './status.js';
import { INTERNAL_SERVER_ERROR } from '@shgysk8zer0/consts/status.js';

export class HTTPError extends Error {
#status = INTERNAL_SERVER_ERROR;
Expand Down
3 changes: 2 additions & 1 deletion form-data.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FORM_MULTIPART, FORM_URL_ENCODED, OCTET_STREAM } from './types.js';
import { FORM_MULTIPART, FORM_URL_ENCODED, OCTET_STREAM } from '@shgysk8zer0/consts/mimes.js';

const PATTERN = /^(\r\n)?(?:Content-Disposition:\s?form-data;\s?name="(?<name>[^"]*)";?)(?:\s?filename="(?<filename>[^"]*)")?;?(?:\r\nContent-Type:\s?(?<contentType>[^\r\n]+))?;?(\r\n){2}(?<data>[^])?(\r\n)?$/i;

Expand Down Expand Up @@ -46,6 +46,7 @@ export function parseMultipartFormData(body, contentType) {
/**
* Parse a URL-encoded form data body and convert it into FormData.
*
* @deprecated Node >= 20 offers native form data handling via `await new Request().formData()`
* @param {string} body - The raw string of the URL-encoded form data body.
* @param {string} contentType - The Content-Type header specifying the encoding.
* @returns {FormData} - A FormData object containing the parsed data.
Expand Down
4 changes: 2 additions & 2 deletions http.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './polyfills/all.js';
export * from './status.js';
export * as STATUS from '@shgysk8zer0/consts/status.js';
export * as STATUS_TEXT from '@shgysk8zer0/consts/status-text.js';
export * from './error.js';
export * from './utils.js';
export * from './form-data.js';
export * from './cookie.js';
Loading

0 comments on commit 5c77547

Please sign in to comment.