New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cfworker/web

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cfworker/web - npm Package Compare versions

Comparing version 1.8.0 to 1.8.1

dist/normalize-pathname.d.ts

1

dist/index.d.ts

@@ -7,2 +7,3 @@ export * from './accepts.js';

export * from './middleware.js';
export * from './normalize-pathname.js';
export * from './req.js';

@@ -9,0 +10,0 @@ export * from './response-builder.js';

@@ -7,2 +7,3 @@ export * from './accepts.js';

export * from './middleware.js';
export * from './normalize-pathname.js';
export * from './req.js';

@@ -9,0 +10,0 @@ export * from './response-builder.js';

12

dist/req.js
import { safeParse } from 'secure-json-parse';
import { Accepts } from './accepts.js';
import { HttpError } from './http-error.js';
export class Req {

@@ -9,13 +8,2 @@ constructor(request) {

this.url = new URL(request.url);
try {
this.url.pathname = decodeURIComponent(this.url.pathname)
.replace(/\/\/+/g, '/')
.normalize();
}
catch (err) {
if (err instanceof URIError) {
throw new HttpError(400, `Unable to decode pathname "${this.url.pathname}".`);
}
throw err;
}
this.headers = request.headers;

@@ -22,0 +10,0 @@ this.params = Object.create(null);

{
"name": "@cfworker/web",
"version": "1.8.0",
"version": "1.8.1",
"description": "Web framework for Cloudflare Workers and service workers, inspired by Koa and fastify",

@@ -12,2 +12,3 @@ "keywords": [

],
"sideEffects": false,
"main": "dist/index.js",

@@ -37,3 +38,3 @@ "module": "dist/index.js",

"dependencies": {
"@cfworker/json-schema": "^1.8.0",
"@cfworker/json-schema": "^1.8.1",
"@cfworker/worker-types": "^1.8.0",

@@ -64,3 +65,3 @@ "@cloudflare/workers-types": "^2.1.0",

},
"gitHead": "f338fb849e8eb8c0a355680c595a079d0107807e"
"gitHead": "04a6d9e39173ffdfd3067b91be55be1d69abd409"
}

@@ -12,3 +12,9 @@ # @cfworker/web

```ts
import { Application, Middleware, Router, validate } from '@cfworker/web';
import {
Application,
Middleware,
Router,
validate,
normalizePathnameMiddleware
} from '@cfworker/web';

@@ -72,3 +78,7 @@ const router = new Router();

// Compose the application
new Application().use(cors).use(router.middleware).listen();
new Application()
.use(normalizePathnameMiddleware)
.use(cors)
.use(router.middleware)
.listen();
```

@@ -75,0 +85,0 @@

@@ -7,2 +7,3 @@ export * from './accepts.js';

export * from './middleware.js';
export * from './normalize-pathname.js';
export * from './req.js';

@@ -9,0 +10,0 @@ export * from './response-builder.js';

import { Reviver, safeParse } from 'secure-json-parse';
import { Accepts } from './accepts.js';
import { HttpError } from './http-error.js';

@@ -18,15 +17,2 @@ export class Req {

this.url = new URL(request.url);
try {
this.url.pathname = decodeURIComponent(this.url.pathname)
.replace(/\/\/+/g, '/')
.normalize();
} catch (err) {
if (err instanceof URIError) {
throw new HttpError(
400,
`Unable to decode pathname "${this.url.pathname}".`
);
}
throw err;
}
this.headers = request.headers;

@@ -33,0 +19,0 @@ this.params = Object.create(null);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc