Skip to content

fix(nodejs): derive discovery endpoint from request origin - #150

Merged
damaz91 merged 3 commits into
Universal-Commerce-Protocol:mainfrom
ShuoRen-TT:agent/derive-node-discovery-endpoint
Jul 29, 2026
Merged

fix(nodejs): derive discovery endpoint from request origin#150
damaz91 merged 3 commits into
Universal-Commerce-Protocol:mainfrom
ShuoRen-TT:agent/derive-node-discovery-endpoint

Conversation

@ShuoRen-TT

Copy link
Copy Markdown
Contributor

Description

The Node.js sample currently advertises a hard-coded
http://localhost:3000 shopping endpoint in its discovery profile. Requests
served through a different hostname, HTTPS scheme, or port therefore receive an
endpoint that does not identify the server they contacted.

This change derives the REST endpoint from the request URL origin and adds a
regression test covering HTTPS, a custom hostname, and a non-default port. It
does not add trust for forwarded headers or change any other discovery profile
fields.

Category (Required)

  • Core Protocol: Changes to the base communication layer, global context, or breaking refactors. (Requires Technical Council approval)
  • Governance/Contributing: Updates to GOVERNANCE.md, CONTRIBUTING.md, or CODEOWNERS. (Requires Governance Council approval)
  • Capability: New schemas (Discovery, Cart, etc.) or extensions. (Requires Maintainer approval)
  • Documentation: Updates to README, or documentations regarding schema or capabilities. (Requires Maintainer approval)
  • Infrastructure: CI/CD, Linters, or build scripts. (Requires DevOps Maintainer approval)
  • Maintenance: Version bumps, lockfile updates, or minor bug fixes. (Requires DevOps Maintainer approval)
  • SDK: Language-specific SDK updates and releases. (Requires DevOps Maintainer approval)
  • Samples / Conformance: Maintaining samples and the conformance suite. (Requires Maintainer approval)
  • UCP Schema: Changes to the ucp-schema tool (resolver, linter, validator). (Requires Maintainer approval)
  • Community Health (.github): Updates to templates, workflows, or org-level configs. (Requires DevOps Maintainer approval)

Related Issues

No related issue.

Checklist

  • I have followed the Contributing Guide (including Conventional Commits title requirements and ! for breaking changes).
  • No documentation update is required for this focused sample fix.
  • My changes pass all applicable local checks.
  • I have added a regression test that proves the fix is effective.
  • New and existing unit tests pass locally with my changes.
  • No Core/Capability schemas are changed.
  • Python Pydantic model regeneration is not applicable.

Screenshots / Logs (if applicable)

Validated with Node.js v20.20.2, matching the repository CI runtime:

npm run build
# passed

npm test
# tests 28
# pass 28
# fail 0

@ShuoRen-TT
ShuoRen-TT marked this pull request as ready for review July 29, 2026 12:30
@damaz91
damaz91 merged commit 746e138 into Universal-Commerce-Protocol:main Jul 29, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants