Compare commits

...

8 Commits

Author SHA1 Message Date
5c7f9e5bfa 3.0.28 2023-07-09 17:24:53 +02:00
14bda0bfa3 fix(core): update 2023-07-09 17:24:52 +02:00
4a57f7070a 3.0.27 2023-07-09 17:20:12 +02:00
f36bdcb181 fix(core): update 2023-07-09 17:20:12 +02:00
d3c90b0e7e 3.0.26 2023-07-03 10:08:45 +02:00
2397e69572 fix(core): update 2023-07-03 10:08:44 +02:00
7f7738d69f 3.0.25 2023-07-03 10:08:16 +02:00
f375e36a99 fix(core): update 2023-07-03 10:08:16 +02:00
5 changed files with 102 additions and 266 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/webrequest", "name": "@pushrocks/webrequest",
"version": "3.0.24", "version": "3.0.28",
"private": false, "private": false,
"description": "securely request from browsers", "description": "securely request from browsers",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@ -18,12 +18,12 @@
"@gitzone/tsbundle": "^2.0.8", "@gitzone/tsbundle": "^2.0.8",
"@gitzone/tsrun": "^1.2.42", "@gitzone/tsrun": "^1.2.42",
"@gitzone/tstest": "^1.0.73", "@gitzone/tstest": "^1.0.73",
"@pushrocks/smartexpress": "^4.0.35",
"@pushrocks/tapbundle": "^5.0.8", "@pushrocks/tapbundle": "^5.0.8",
"@types/node": "^20.3.3" "@types/node": "^20.3.3"
}, },
"dependencies": { "dependencies": {
"@adobe/fetch": "^4.0.13", "@adobe/fetch": "^4.0.13",
"@apiglobal/typedserver": "^2.0.65",
"@pushrocks/smartdelay": "^3.0.1", "@pushrocks/smartdelay": "^3.0.1",
"@pushrocks/smartenv": "^5.0.2", "@pushrocks/smartenv": "^5.0.2",
"@pushrocks/smartjson": "^5.0.6", "@pushrocks/smartjson": "^5.0.6",

348
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -2,12 +2,12 @@ import { expect, tap } from '@pushrocks/tapbundle';
import * as webrequest from '../ts/index.js'; import * as webrequest from '../ts/index.js';
// test dependencies // test dependencies
import * as smartexpress from '@pushrocks/smartexpress'; import * as typedserver from '@apiglobal/typedserver';
let testServer: smartexpress.Server; let testServer: typedserver.servertools.Server;
tap.test('setup test server', async () => { tap.test('setup test server', async () => {
testServer = new smartexpress.Server({ testServer = new typedserver.servertools.Server({
cors: false, cors: false,
forceSsl: false, forceSsl: false,
port: 2345, port: 2345,
@ -15,7 +15,7 @@ tap.test('setup test server', async () => {
testServer.addRoute( testServer.addRoute(
'/apiroute1', '/apiroute1',
new smartexpress.Handler('GET', (req, res) => { new typedserver.servertools.Handler('GET', (req, res) => {
res.status(429); res.status(429);
res.end(); res.end();
}) })
@ -23,7 +23,7 @@ tap.test('setup test server', async () => {
testServer.addRoute( testServer.addRoute(
'/apiroute2', '/apiroute2',
new smartexpress.Handler('GET', (req, res) => { new typedserver.servertools.Handler('GET', (req, res) => {
res.status(500); res.status(500);
res.end(); res.end();
}) })
@ -31,7 +31,7 @@ tap.test('setup test server', async () => {
testServer.addRoute( testServer.addRoute(
'/apiroute3', '/apiroute3',
new smartexpress.Handler('GET', (req, res) => { new typedserver.servertools.Handler('GET', (req, res) => {
res.status(200); res.status(200);
res.send({ res.send({
hithere: 'hi', hithere: 'hi',

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@pushrocks/webrequest', name: '@pushrocks/webrequest',
version: '3.0.24', version: '3.0.28',
description: 'securely request from browsers' description: 'securely request from browsers'
} }

View File

@ -27,7 +27,6 @@ export class WebRequest {
this.polyfillStatusEvaluated = true; this.polyfillStatusEvaluated = true;
const smartenv = new plugins.smartenv.Smartenv(); const smartenv = new plugins.smartenv.Smartenv();
if (!smartenv.isBrowser) { if (!smartenv.isBrowser) {
console.log('webrequest using node context.');
this.polyfillStatusEvaluated = true; this.polyfillStatusEvaluated = true;
const fetchMod = await smartenv.getSafeNodeModule('@adobe/fetch'); const fetchMod = await smartenv.getSafeNodeModule('@adobe/fetch');
this.neededPolyfillsLoadedDeferred.resolve({ this.neededPolyfillsLoadedDeferred.resolve({
@ -36,7 +35,6 @@ export class WebRequest {
helixTimeout: fetchMod.timeoutSignal, helixTimeout: fetchMod.timeoutSignal,
}); });
} else { } else {
console.log('webrequest using browser context.');
this.neededPolyfillsLoadedDeferred.resolve({ this.neededPolyfillsLoadedDeferred.resolve({
fetch: (...args) => { fetch: (...args) => {
return fetch(...args); return fetch(...args);