[akamai-edgeworkers] Update README link (#43995)

* Automated whitespace fixes

* Update link to EdgeWorker API
This commit is contained in:
William Bain 2020-04-17 17:21:42 -04:00 committed by GitHub
parent b78e68187c
commit ab55613f52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 18 deletions

View File

@ -1,13 +1,13 @@
Bindings for the Akamai [EdgeWorker API]. This allows you to write
your EdgeWorkers in TypeScript.
Bindings for the Akamai [EdgeWorker API]. This allows you to write
your EdgeWorkers in TypeScript.
Types are available for the `Request` and `Response` objects, as well as the
built-in modules.
Types are available for the `Request` and `Response` objects, as well as the
built-in modules.
# User Guide
EdgeWorkers are written in ECMAScript6, so you need to set your
`tsconfig.json` to use `es6` as the compilation target and module
EdgeWorkers are written in ECMAScript6, so you need to set your
`tsconfig.json` to use `es6` as the compilation target and module
code generator:
```json5
@ -15,14 +15,14 @@ code generator:
"compilerOptions": {
"module": "es6",
"target": "es6",
//...
//...
}
}
```
```
## Using the `Request` and `Response` Objects
The predefined EdgeWorker callbacks take Request and Response objects as
The predefined EdgeWorker callbacks take Request and Response objects as
arguments. After you have installed this package, you can create a `main.ts`
with the following stubs:
@ -35,12 +35,12 @@ export function onOriginResponse(request: EW.EgressOriginRequest, response: EW.E
export function onClientResponse(request: EW.EgressClientRequest, response: EW.EgressClientResponse) {}
```
The triple-slashed first line references this package and pulls `EW` into your
namespace.
The triple-slashed first line references this package and pulls `EW` into your
namespace.
## Using Built-In Modules
Bindings are available for the built-in `cookies` and `url-search-params`
Bindings are available for the built-in `cookies` and `url-search-params`
modules. Once you've added the triple-slash reference to `akamai-edgeworkers`
you can import them normally:
@ -51,8 +51,8 @@ import { Cookies } from 'cookies';
function onClientRequest(request: EW.MutableRequest & EW.HasRespondWith) {
const cookie = new Cookies(request.getHeader('cookies') || undefined);
//...
//...
}
```
[EdgeWorker API]: https://developer.akamai.com/api/web_performance/edgeworkers/v1.html
[EdgeWorker API]: https://learn.akamai.com/en-us/webhelp/edgeworkers/edgeworkers-user-guide/GUID-14077BCA-0D9F-422C-8273-2F3E37339D5B.html

View File

@ -170,7 +170,7 @@ declare namespace EW {
readonly query: string;
/**
* The Relative URL of the incoming request. This includes the path as well
* The relative URL of the incoming request. This includes the path as well
* as the query string.
*/
readonly url: string;
@ -183,19 +183,19 @@ declare namespace EW {
readonly userLocation: UserLocation | undefined;
/**
* Object containing properties specifying the device characteristics. This
* Object containing properties specifying the device characteristics. The
* value of this property will be null if the contract associated with the
* request does not have entitlements for EDC.
*/
readonly device: Device | undefined;
/**
* The cpcode used for reporting.
* The CP code used for reporting.
*/
readonly cpCode: number;
}
// Legacy interfaces for backwards compatability
// Legacy interfaces for backwards compatibility
interface MutableRequest extends MutatesHeaders, ReadsHeaders, ReadsVariables, Request {
}
interface ImmutableRequest extends ReadsHeaders, ReadsVariables, Request {