Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fastly/expressly

Package Overview
Dependencies
Maintainers
40
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastly/expressly - npm Package Compare versions

Comparing version 1.0.0-alpha.3 to 1.0.0-alpha.4

14

dist/lib/routing/request/index.d.ts
/// <reference types="@fastly/js-compute" />
import { ECommonObject } from "../common";
import { CookieMap } from "./cookie-map";
import { EConfig } from "..";
export declare class ERequest extends ECommonObject {
export declare class ERequest extends Request {
private config;

@@ -18,3 +17,2 @@ private event;

constructor(config: EConfig, event: FetchEvent);
get url(): string;
get path(): string;

@@ -26,5 +24,9 @@ get ip(): string;

get hostname(): string;
json(): Promise<any>;
text(): Promise<string>;
arrayBuffer(): Promise<ArrayBuffer>;
set(headerNameOrObject: string | {
[key: string]: string;
}, value?: string): void;
private appendHeader;
append(headerNameOrObject: string | {
[key: string]: string | string[];
}, value?: string | string[]): void;
}

@@ -1,6 +0,5 @@

import { ECommonObject } from "../common";
import { CookieMap } from "./cookie-map";
export class ERequest extends ECommonObject {
export class ERequest extends Request {
constructor(config, event) {
super();
super(event.request);
this.config = config;

@@ -10,6 +9,4 @@ this.event = event;

this.clientInfo = event.client;
this.method = event.request.method;
this.urlObj = new URL(event.request.url);
this.query = this.urlObj.searchParams;
this.headers = event.request.headers;
// Parse cookies.

@@ -21,5 +18,6 @@ if (this.config.parseCookie) {

// Express-like URL helpers.
get url() {
return this.urlObj.toString();
}
// get url(): string {
// console.log("custom getter");
// return this.urlObj.toString();
// }
get path() {

@@ -43,11 +41,33 @@ return this.urlObj.pathname;

}
async json() {
return await this.event.request.json();
// Header helpers.
set(headerNameOrObject, value) {
if (typeof headerNameOrObject === "string") {
this.headers.set(headerNameOrObject, value);
}
else {
Object.keys(headerNameOrObject).forEach((headerName) => {
this.headers.set(headerName, headerNameOrObject[headerName]);
});
}
}
async text() {
return await this.event.request.text();
appendHeader(headerName, headerValue) {
if (typeof headerValue === "string") {
this.headers.append(headerName, headerValue);
}
else if (Array.isArray(headerValue)) {
headerValue.forEach((v) => {
this.headers.append(headerName, v);
});
}
}
async arrayBuffer() {
return await this.event.request.arrayBuffer();
append(headerNameOrObject, value) {
if (typeof headerNameOrObject === "string") {
this.appendHeader(headerNameOrObject, value);
}
else {
Object.keys(headerNameOrObject).forEach((headerName) => {
this.appendHeader(headerName, headerNameOrObject[headerName]);
});
}
}
}
{
"name": "@fastly/expressly",
"version": "1.0.0-alpha.3",
"version": "1.0.0-alpha.4",
"description": "Express-style router for Fastly's Compute@Edge.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -20,7 +20,7 @@ # expressly

```shell
npm i @fastly/expressly@1.0.0-alpha.3
npm i @fastly/expressly@1.0.0-alpha.4
```
```shell
yarn add @fastly/expressly@1.0.0-alpha.3
yarn add @fastly/expressly@1.0.0-alpha.4
```

@@ -27,0 +27,0 @@

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