Skip to content

fix(cloud-function): reject missing + invalid /pong/viewed codes - #514

Open
caugner wants to merge 2 commits into
proxy-bsa-testsfrom
pong-viewed-status
Open

caugner wants to merge 2 commits into
proxy-bsa-testsfrom
pong-viewed-status

Conversation

@caugner

@caugner caugner commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Description

Fix /pong/viewed to return 400 for missing codes and 404 for invalid codes. Add tests covering rejected codes and successful view requests.

Motivation

Prevent requests with missing or invalid codes from being acknowledged as recorded views.

Additional details

Invalid codes return 404, matching /pong/click, without contacting upstream. Valid requests continue to return 201.

Related issues and pull requests

Depends on: #513

@caugner
caugner added this pull request to stack #515 September 9, 2026 10:18
`proxyBSA` discarded the status returned by the viewed handler and
always answered 201, so a request missing the `code` parameter was
acknowledged as a recorded view.
Comment thread cloud-function/src/handlers/proxy-bsa.test.js
@caugner caugner changed the title fix(cloud-function): return 400 for /pong/viewed without code fix(cloud-function): reject missing + invalid /pong/viewed codes Sep 16, 2026
Comment thread cloud-function/src/internal/pong/pong2.js Dismissed
@caugner
caugner marked this pull request as ready for review September 16, 2026 09:06
@caugner
caugner requested a review from a team as a code owner September 16, 2026 09:06
@caugner
caugner requested a review from LeoMcA September 16, 2026 09:06
redirect: "manual",
});
if (!view) {
console.warn("[pong/viewed] Invalid code value");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is it really a warning? Perhaps it's more info/debug level?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants