@webscale-networks/cloudedge-handlers
Version:
Webscale Networks CloudEDGE Handlers for cloud-agnostic edge function execution
68 lines (65 loc) • 1.76 kB
JavaScript
const http = require('../../../execution_context/utils/src/headers.js');
exports.mockRequest = (() => {
return {
headers: new http.Headers(
{
'header': [
{
key: 'header',
value: 'value',
}
]
},
),
method: 'GET',
peerAddress: '1.2.3.4',
query: 'delay=10s',
path: '/ex/veldt.html',
originRequest: {
headers: new http.Headers(
{
'custom-header': [
{
key: 'custom-header',
value: 'custom-value',
}
]
},
),
host: 'sample.app.com',
path: '/ex/cached/veldt.html',
keepaliveTimeout: 10,
port: 443,
protocol: 'https',
readTimeout: 5,
sslProtocols: [],
},
body: {
truncated: false,
modified: false,
encoding: 'text',
data: '<html>Hello World!</html>',
},
providerSpecific: {
authMethod: 'none',
requestId: 'abc123',
distributionId: 'xyz789',
distributionDomainName: 'myapp.com',
},
};
});
exports.mockResponse = (() => {
return {
headers: new http.Headers(),
body: {
encoding: 'text',
data: '',
},
statusCode: 200,
providerSpecific: {
requestId: 'abc123',
distributionId: 'xyz789',
distributionDomainName: 'myapp.com',
}
};
});