Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions integration-tests/js-compute/fixtures/app/fastly.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ service_id = ""
url = "https://compute-sdk-test-backend.edgecompute.app"
override_host = "compute-sdk-test-backend.edgecompute.app"

[local_server.backends.httpbin]
url = "https://httpbin.org"
override_host = "httpbin.org"

[local_server.backends.httpme]
url = "https://http-me.glitch.me"
override_host = "http-me.glitch.me"
Expand Down Expand Up @@ -118,11 +114,6 @@ service_id = ""

[setup]
[setup.backends]

[setup.backends.httpbin]
address = "httpbin.org"
port = 443

[setup.backends.httpme]
address = "http-me.glitch.me"
port = 443
Expand Down
12 changes: 6 additions & 6 deletions integration-tests/js-compute/fixtures/app/src/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@ routes.set('/headers/getsetcookie', async () => {
});

routes.set('/headers/from-response/set', async () => {
const response = await fetch('https://httpbin.org/stream-bytes/11', {
backend: 'httpbin',
const response = await fetch('https://http-me.glitch.me/anything', {
backend: 'httpme',
cacheOverride: new CacheOverride('pass'),
});
response.headers.set('cuStom', 'test');
return response;
});

routes.set('/headers/from-response/delete-invalid', async () => {
const response = await fetch('https://httpbin.org/stream-bytes/11', {
backend: 'httpbin',
const response = await fetch('https://http-me.glitch.me/anything', {
backend: 'httpme',
cacheOverride: new CacheOverride('pass'),
});
response.headers.delete('none');
return response;
});

routes.set('/headers/from-response/set-delete', async () => {
const response = await fetch('https://httpbin.org/stream-bytes/11', {
backend: 'httpbin',
const response = await fetch('https://http-me.glitch.me/anything', {
backend: 'httpme',
cacheOverride: new CacheOverride('pass'),
});
response.headers.set('custom', 'test');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ routes.set(
);

async function responseMethod(setManualFramingHeaders) {
const response = await fetch('https://httpbin.org/stream-bytes/11', {
backend: 'httpbin',
const response = await fetch('https://http-me.glitch.me/drip=11', {
backend: 'httpme',
cacheOverride: new CacheOverride('pass'),
});
response.setManualFramingHeaders(setManualFramingHeaders);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ routes.set('/multiple-set-cookie/response-direct', async () => {
});
routes.set('/multiple-set-cookie/downstream', async () => {
let response = await fetch(
'https://httpbin.org/cookies/set?1=1&2=2&3=3&4=4&5=5&6=6&7=7&8=8&9=9&10=10&11=11',
'https://http-me.glitch.me/append-header=Set-Cookie:test1=1/append-header=Set-Cookie:test2=2/append-header=Set-Cookie:test3=3/anything',
{
backend: 'httpbin',
backend: 'httpme',
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { routes } from './routes.js';

// Request.fastly.decompressGzip option -- automatic gzip decompression of responses
routes.set('/request/constructor/fastly/decompressGzip/true', async () => {
const request = new Request('https://httpbin.org/gzip', {
const request = new Request('https://http-me.glitch.me/gzip', {
headers: {
accept: 'application/json',
},
backend: 'httpbin',
backend: 'httpme',
fastly: {
decompressGzip: true,
},
Expand All @@ -20,11 +20,11 @@ routes.set('/request/constructor/fastly/decompressGzip/true', async () => {
});

routes.set('/request/constructor/fastly/decompressGzip/false', async () => {
const request = new Request('https://httpbin.org/gzip', {
const request = new Request('https://http-me.glitch.me/gzip', {
headers: {
accept: 'application/json',
},
backend: 'httpbin',
backend: 'httpme',
cacheOverride: 'pass',
fastly: {
decompressGzip: false,
Expand All @@ -38,11 +38,11 @@ routes.set('/request/constructor/fastly/decompressGzip/false', async () => {
});

routes.set('/fetch/requestinit/fastly/decompressGzip/true', async () => {
const response = await fetch('https://httpbin.org/gzip', {
const response = await fetch('https://http-me.glitch.me/gzip', {
headers: {
accept: 'application/json',
},
backend: 'httpbin',
backend: 'httpme',
fastly: {
decompressGzip: true,
},
Expand All @@ -53,11 +53,11 @@ routes.set('/fetch/requestinit/fastly/decompressGzip/true', async () => {
});

routes.set('/fetch/requestinit/fastly/decompressGzip/false', async () => {
const response = await fetch('https://httpbin.org/gzip', {
const response = await fetch('https://http-me.glitch.me/gzip', {
headers: {
accept: 'application/json',
},
backend: 'httpbin',
backend: 'httpme',
cacheOverride: 'pass',
fastly: {
decompressGzip: false,
Expand Down
16 changes: 5 additions & 11 deletions integration-tests/js-compute/fixtures/app/src/response.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env serviceworker */

import { routes } from './routes.js';
import { assert } from './assertions.js';
import { assert, streamToString } from './assertions.js';
import { allowDynamicBackends } from 'fastly:experimental';

routes.set('/response/stall', async (event) => {
Expand Down Expand Up @@ -58,21 +58,15 @@ routes.set('/response/ip-port-undefined', async () => {

routes.set('/response/request-body-init', async () => {
allowDynamicBackends(true);
// fetch an image
const downloadResp = await fetch('https://httpbin.org/image', {
headers: {
accept: 'image/webp',
},
});
// stream it through an echo proxy
const downloadResp = await fetch('https://http-me.glitch.me/json');
const postResp = await fetch(
new Request('https://httpbin.org/anything', {
new Request('https://http-me.glitch.me/anything', {
method: 'POST',
body: downloadResp.body,
}),
);
// finally stream back to user
return postResp;
let body = await postResp.json();
assert(JSON.parse(body['body'])['data']['name'] === 'Test Product', true);
});

routes.set('/response/blob', async () => {
Expand Down
12 changes: 6 additions & 6 deletions integration-tests/js-compute/fixtures/app/src/tee.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-env serviceworker */
import { routes } from './routes.js';
import { assert } from './assertions.js';

routes.set('/tee', async function (event) {
const req = event.request;
Expand All @@ -13,29 +14,28 @@ routes.set('/tee', async function (event) {
// `pending_req_select`, as we were waiting on an http request whose body had
// not been closed.
let res = await fetch(
new Request('/post', {
new Request('/anything', {
body: body1,
headers: req.headers,
method: req.method,
backend: 'httpbin',
backend: 'httpme',
}),
);
let body = await res.json();

return new Response(body.data);
assert(body['body'], 'hello world!');
});

routes.set('/tee/error', async function (event) {
const req = event.request;
let res = fetch('/post', {
let res = fetch('/anything', {
method: 'POST',
body: new ReadableStream({
start: (controller) => {
controller.enqueue('Test');
controller.close();
},
}),
backend: 'httpbin',
backend: 'httpme',
});

return res
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/js-compute/fixtures/app/src/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,13 @@ import { CacheOverride } from 'fastly:cache-override';
});
routes.set('/setTimeout/fetch-timeout', async () => {
let timedOut = false;
const first = fetch('https://httpbin.org/delay/2', {
backend: 'httpbin',
const first = fetch('https://http-me.glitch.me/wait=200', {
backend: 'httpme',
cacheOverride: new CacheOverride('pass'),
});
const second = Promise.race([
fetch('https://httpbin.org/delay/2', {
backend: 'httpbin',
fetch('https://http-me.glitch.me/wait=200', {
backend: 'httpme',
cacheOverride: new CacheOverride('pass'),
}),
new Promise((resolve) => setTimeout(resolve, 5)).then(() => {
Expand Down
36 changes: 5 additions & 31 deletions integration-tests/js-compute/fixtures/app/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -1159,19 +1159,11 @@
},
"GET /multiple-set-cookie/downstream": {
"downstream_response": {
"status": 302,
"status": 200,
"headers": [
["Set-Cookie", "1=1; Path=/"],
["Set-Cookie", "2=2; Path=/"],
["Set-Cookie", "3=3; Path=/"],
["Set-Cookie", "4=4; Path=/"],
["Set-Cookie", "5=5; Path=/"],
["Set-Cookie", "6=6; Path=/"],
["Set-Cookie", "7=7; Path=/"],
["Set-Cookie", "8=8; Path=/"],
["Set-Cookie", "9=9; Path=/"],
["Set-Cookie", "10=10; Path=/"],
["Set-Cookie", "11=11; Path=/"]
["Set-Cookie", "test1=1"],
["Set-Cookie", "test2=2"],
["Set-Cookie", "test3=3"]
]
}
},
Expand Down Expand Up @@ -1234,21 +1226,7 @@
"GET /response/arrayBuffer/guest-backed-stream": {},
"GET /response/json": {},
"GET /response/redirect": {},
"GET /response/request-body-init": {
"flake": true,
"downstream_response": {
"status": 200,
"body_prefix": [
123, 10, 32, 32, 34, 97, 114, 103, 115, 34, 58, 32, 123, 125, 44, 32,
10, 32, 32, 34, 100, 97, 116, 97, 34, 58, 32, 34, 100, 97, 116, 97, 58,
97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 111, 99, 116,
101, 116, 45, 115, 116, 114, 101, 97, 109, 59, 98, 97, 115, 101, 54, 52,
44, 85, 107, 108, 71, 82, 107, 65, 112, 65, 65, 66, 88, 82, 85, 74, 81,
86, 108, 65, 52, 87, 65, 111, 65, 65, 65, 65, 69, 65, 65, 65, 65, 69, 81
],
"body_suffix": [123, 10, 32, 32, 34, 97, 114, 103, 115, 34, 58, 32]
}
},
"GET /response/request-body-init": {},
"GET /response/ip-port-undefined": {},
"GET /setInterval/exposed-as-global": {},
"GET /setInterval/interface": {},
Expand Down Expand Up @@ -1322,10 +1300,6 @@
"pathname": "/tee",
"headers": ["Content-Type", "application/json"],
"body": "hello world!"
},
"downstream_response": {
"status": 200,
"body": "hello world!"
}
},
"GET /tee/error": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ service_id = ""
url = "https://compute-sdk-test-backend.edgecompute.app"
override_host = "compute-sdk-test-backend.edgecompute.app"

[local_server.backends.httpbin]
url = "https://httpbin.org"
override_host = "httpbin.org"

[local_server.backends.httpme]
url = "https://http-me.glitch.me"
override_host = "http-me.glitch.me"
Expand Down Expand Up @@ -118,11 +114,6 @@ service_id = ""

[setup]
[setup.backends]

[setup.backends.httpbin]
address = "httpbin.org"
port = 443

[setup.backends.httpme]
address = "http-me.glitch.me"
port = 443
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { CacheOverride } from 'fastly:cache-override';

// generate a unique URL everytime so that we never work on a populated cache
const getTestUrl = (path = `/${Math.random().toString().slice(2)}`) =>
'https://httpbin.org/anything' + path;
'https://http-me.glitch.me/anything' + path;

// afterSend error handling
{
Expand Down Expand Up @@ -466,7 +466,7 @@ const getTestUrl = (path = `/${Math.random().toString().slice(2)}`) =>
});
strictEqual(calledAfterSend, true);
// verify we get a proper response (url included in response)
strictEqual((await res.json()).url, url);
strictEqual('https://http-me.glitch.me' + (await res.json()).url, url);
});

// Test response property mutations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,7 @@ const debug = sdkVersion.endsWith('-debug');
metadata: 'cbad',
});
const c5Entry = await store.get('c5');
if (isRunningLocally()) {
strictEqual(await c5Entry.text(), 'cbad');
} else {
// for some reason, compute doesn't support prepend?
strictEqual(await c5Entry.text(), 'd');
}
strictEqual(await c5Entry.text(), 'cbad');
assertRejects(async () => await c5Entry.metadataText(), TypeError);

// TTL only supported on compute not viceroy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@
"date": true,
"content-type": true,
"fastly_service_version": true,
"server": true,
"custom": "custom-header",
"x-cache": true,
"x-cache-hits": true,
Expand Down
Loading