[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: harness: do not follow redire
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: harness: do not follow redirects in certain tests |
Date: |
Tue, 06 Feb 2024 19:35:57 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 6c496c070 harness: do not follow redirects in certain tests
6c496c070 is described below
commit 6c496c070d47e26034a3e2dd6d14a1a9ea42b729
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Feb 6 19:35:55 2024 +0100
harness: do not follow redirects in certain tests
---
build-system/taler-build-scripts | 2 +-
.../src/integrationtests/test-merchant-spec-public-orders.ts | 11 +++++++----
packages/taler-util/src/http-common.ts | 8 +++++++-
packages/taler-util/src/http-impl.node.ts | 5 +++--
4 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/build-system/taler-build-scripts b/build-system/taler-build-scripts
index 001f5dd08..23538677f 160000
--- a/build-system/taler-build-scripts
+++ b/build-system/taler-build-scripts
@@ -1 +1 @@
-Subproject commit 001f5dd081fc8729ff8def90c4a1c3f93eb8689a
+Subproject commit 23538677f6c6be2a62f38dc6137ecdd1c76b7b15
diff --git
a/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts
b/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts
index 21e2b4a4e..8e664dfa9 100644
---
a/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts
+++
b/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts
@@ -297,8 +297,11 @@ async function testWithClaimToken(
url.searchParams.set("session_id", sessionId);
const httpResp = await httpLib.fetch(url.href, {
headers: { Accept: "text/html" },
+ redirect: "manual",
});
- console.log(`requesting GET ${url.href}, expected 302 got
${httpResp.status}`);
+ console.log(
+ `requesting GET ${url.href}, expected 302 got ${httpResp.status}`,
+ );
t.assertDeepEqual(httpResp.status, 302);
const location = httpResp.headers.get("Location");
console.log("location header:", location);
@@ -554,6 +557,7 @@ async function testWithoutClaimToken(
url.searchParams.set("session_id", sessionId);
const httpResp = await httpLib.fetch(url.href, {
headers: { Accept: "text/html" },
+ redirect: "manual",
});
t.assertDeepEqual(httpResp.status, 302);
const location = httpResp.headers.get("Location");
@@ -569,9 +573,8 @@ async function testWithoutClaimToken(
* specification of the endpoint.
*/
export async function runMerchantSpecPublicOrdersTest(t: GlobalTestState) {
- const { bank, exchange, merchant } = await
createSimpleTestkudosEnvironmentV2(
- t,
- );
+ const { bank, exchange, merchant } =
+ await createSimpleTestkudosEnvironmentV2(t);
// Base URL for the default instance.
const merchantBaseUrl = merchant.makeInstanceBaseUrl();
diff --git a/packages/taler-util/src/http-common.ts
b/packages/taler-util/src/http-common.ts
index 705881801..3973e66fb 100644
--- a/packages/taler-util/src/http-common.ts
+++ b/packages/taler-util/src/http-common.ts
@@ -27,7 +27,7 @@ import {
} from "./index.js";
import { Logger } from "./logging.js";
import { TalerErrorCode } from "./taler-error-codes.js";
-import { Duration, AbsoluteTime } from "./time.js";
+import { AbsoluteTime, Duration } from "./time.js";
import { TalerErrorDetail } from "./wallet-types.js";
const textEncoder = new TextEncoder();
@@ -65,6 +65,12 @@ export interface HttpRequestOptions {
cancellationToken?: CancellationToken;
body?: string | ArrayBuffer | object;
+
+ /**
+ * How to handle redirects.
+ * Same semantics as WHATWG fetch.
+ */
+ redirect?: "follow" | "error" | "manual";
}
/**
diff --git a/packages/taler-util/src/http-impl.node.ts
b/packages/taler-util/src/http-impl.node.ts
index b9c007b35..8ca2deecd 100644
--- a/packages/taler-util/src/http-impl.node.ts
+++ b/packages/taler-util/src/http-impl.node.ts
@@ -21,7 +21,7 @@
*/
import * as net from "node:net";
import type { ClientRequest, IncomingMessage } from "node:http";
-import { RedirectableRequest, http, https } from "follow-redirects";
+import { FollowOptions, RedirectableRequest, http, https } from
"follow-redirects";
import { RequestOptions } from "node:http";
import { TalerError } from "./errors.js";
import { encodeBody, getDefaultHeaders, HttpLibArgs } from "./http-common.js";
@@ -141,7 +141,7 @@ export class HttpLibImpl implements HttpRequestLibrary {
throw Error(`unsupported protocol (${parsedUrl.protocol})`);
}
- const options: RequestOptions = {
+ const options: RequestOptions & FollowOptions<RequestOptions> = {
protocol,
port: parsedUrl.port,
host: parsedUrl.hostname,
@@ -149,6 +149,7 @@ export class HttpLibImpl implements HttpRequestLibrary {
path,
headers: requestHeadersMap,
timeout: timeoutMs,
+ followRedirects: opt?.redirect !== "manual",
};
const chunks: Uint8Array[] = [];
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: harness: do not follow redirects in certain tests,
gnunet <=