From 5bbc1e124e7e6aa66fae6be88901aeaa2423262a Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Wed, 14 Oct 2026 16:52:26 +0800 Subject: [PATCH] fix(storefront): Create Customer Socket Token expects 404 while socket auth is off Socket authentication is off by default and off in production until its rollout reaches it, so the documented answer is 404 and clients connect anonymously. The request asserts that unless the environment declares socket_auth_enabled, in which case it expects a token with its expiry. --- .../Create Customer Socket Token.request.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/postman/collections/Fleetbase Storefront API/Customer/Create Customer Socket Token.request.yaml b/postman/collections/Fleetbase Storefront API/Customer/Create Customer Socket Token.request.yaml index 4377496..fddb127 100644 --- a/postman/collections/Fleetbase Storefront API/Customer/Create Customer Socket Token.request.yaml +++ b/postman/collections/Fleetbase Storefront API/Customer/Create Customer Socket Token.request.yaml @@ -16,4 +16,26 @@ body: type: json content: |- {} +scripts: + - type: beforeRequest + code: |- + // Socket authentication is off by default, and off in production until its rollout + // reaches it; while it is off this endpoint answers 404 and clients connect + // anonymously. That is the contract asserted unless the environment declares + // socket_auth_enabled, in which case a token is expected. + if (!pm.environment.get('socket_auth_enabled')) { + pm.variables.set('expected_status', 404); + } + language: text/javascript + - type: afterResponse + code: |- + if (pm.response.code === 200) { + var json_response = pm.response.json(); + pm.test('A socket token comes with its expiry', function () { + pm.expect(json_response.token, 'token missing').to.be.a('string').and.not.empty; + pm.expect(json_response.expires_in, 'expires_in missing').to.be.a('number'); + pm.expect(json_response.expires_at, 'expires_at missing').to.be.a('string').and.not.empty; + }); + } + language: text/javascript order: 5150