Skip to content

Commit

Permalink
style: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
amitksingh1490 committed Mar 1, 2024
1 parent 9272eed commit c922b13
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions docs/guides/update-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function onEvent(event) {
// Implement request modifications here
}
// Additional processing can be done here
return event; // Ensure the modified event is returned
return event // Ensure the modified event is returned
}
```

Expand All @@ -24,25 +24,25 @@ The `event` parameter is structured as follows:
```typescript
// Definition of the HTTP request structure
type HttpRequest = {
method: string;
url: string;
headers: {[key: string]: string};
};
method: string
url: string
headers: {[key: string]: string}
}

// Definition of the HTTP response structure
type HttpResponse = {
status: number;
headers: {[key: string]: string};
body: ArrayBuffer | Uint8Array;
};
status: number
headers: {[key: string]: string}
body: ArrayBuffer | Uint8Array
}

// Message structure can either be a request or a response
type Message = {request: HttpRequest} | {response: HttpResponse};
type Message = {request: HttpRequest} | {response: HttpResponse}

// Event interface encapsulating the message, optionally including an identifier
interface Event {
message: Message;
id?: number;
message: Message
id?: number
}
```

Expand All @@ -53,13 +53,13 @@ function onEvent(event) {
// Check if the event encapsulates a request
if (event.message.request) {
// Retrieve the current 'app-id' header value
let appID = event.message.request.headers['app-id'];
let appID = event.message.request.headers["app-id"]
// Conditionally modify the 'app-id' header value
if (appID === '123') {
event.message.request.headers['app-id'] = '456'; // Update the header value
if (appID === "123") {
event.message.request.headers["app-id"] = "456" // Update the header value
}
}
return event; // Return the potentially modified event object
return event // Return the potentially modified event object
}
```

Expand Down

0 comments on commit c922b13

Please sign in to comment.