Skip to content

Instantly share code, notes, and snippets.

@tolmasky
Created December 2, 2018 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tolmasky/870b05106a847ab2af5c3e91ef0dd7c9 to your computer and use it in GitHub Desktop.
Save tolmasky/870b05106a847ab2af5c3e91ef0dd7c9 to your computer and use it in GitHub Desktop.
# Endpoint
## Export "endpoint"
| plugin | `@lithograph/http-response` |
|-----------------------------|---------------|
```javascript
const page = await (await getBrowserContext())
.open.and.login("default-user");
await page.goto.runkit.notebook.new();
await page.notebook.cell(0).type(
`module.exports.endpoint = (_, response) => response.end('OK!');`);
await page.notebook.wait.for.save();
const endpointURL = page.notebook.endpointURL();
expect(response.status).toBe(200);
expect(await response.text()).toBe("OK!");
```
> <b>plugin:</b> <b>@lithograph/http-response</b></td></b></summary>
>
> | key | value |
> |-----------------------------|---------------|
> | endpoint | `endpointURL` |
> | status | `200` |
> | **HEADERS** | |
> | x-powered-by | runkit.com |
> | runkit-rate-limit-remaining | `PRESENT` |
> | **BODY** | |
> | text | OK! |
| key | value |
|-----------------------------|---------------|
| endpoint | `endpointURL` |
| status | `200` |
| **HEADERS** | |
| x-powered-by | runkit.com |
| runkit-rate-limit-remaining | `PRESENT` |
| **BODY** | |
| text | OK! |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment