Fix: API Try It double-slash URL causing 404 errors#2951
Open
sakshamarora-arch wants to merge 1 commit into
Open
Fix: API Try It double-slash URL causing 404 errors#2951sakshamarora-arch wants to merge 1 commit into
sakshamarora-arch wants to merge 1 commit into
Conversation
Strip trailing slash from server base URL before concatenating with endpoint path. APIs like Test Manager, User Management, and Audit Logs have a trailing slash in their OpenAPI spec server URL, which produced URLs like `test-manager-api.lambdatest.com//api/v1/...` — returning 404. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6 tasks
surishubham
pushed a commit
that referenced
this pull request
May 18, 2026
Three OpenAPI specs (Test Manager, User Management, Audit Logs) declare server URLs ending with `/`. Concatenating with `endpoint.path` (which starts with `/`) produced `//api/v1/...`, returning 404 and surfacing in browsers as "Failed to fetch"/CORS errors. PR #2951 patched 2 sites in TryItModal.js. This commit covers the remaining surfaces so every URL shown to the user — visual, copied, or sent — is clean: TryItModal.js (5 sites): - buildCurl URL concatenation - selectedServer initial state - selectedServer useEffect sync on endpoint change - send-request URL - server dropdown <option> values EndpointDetail.js (4 sites): - selectedBase initial state - selectedBase useEffect sync on endpoint change - copyUrl clipboard URL - server dropdown <option> values langUtils.js (1 site): - generateCodeExample URL (used by all language snippets: cURL/JavaScript/Python/Node/Ruby/Go) Approach: strip trailing slash at two layers — at the source (state + <option> values) so the URL bar displays cleanly, and again at concatenation sites as defense in depth. Uses .replace(/\/+$/, '') which is a no-op when no trailing slash exists, so APIs without the defect are unaffected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
surishubham
pushed a commit
that referenced
this pull request
May 18, 2026
Three OpenAPI specs (Test Manager, User Management, Audit Logs) declare server URLs ending with `/`. Concatenating with `endpoint.path` (which starts with `/`) produced `//api/v1/...`, returning 404 and surfacing in browsers as "Failed to fetch"/CORS errors. PR #2951 patched 2 sites in TryItModal.js. This commit covers the remaining surfaces so every URL shown to the user — visual, copied, or sent — is clean: TryItModal.js (5 sites): - buildCurl URL concatenation - selectedServer initial state - selectedServer useEffect sync on endpoint change - send-request URL - server dropdown <option> values EndpointDetail.js (4 sites): - selectedBase initial state - selectedBase useEffect sync on endpoint change - copyUrl clipboard URL - server dropdown <option> values langUtils.js (1 site): - generateCodeExample URL (used by all language snippets: cURL/JavaScript/Python/Node/Ruby/Go) Approach: strip trailing slash at two layers — at the source (state + <option> values) so the URL bar displays cleanly, and again at concatenation sites as defense in depth. Uses .replace(/\/+$/, '') which is a no-op when no trailing slash exists, so APIs without the defect are unaffected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test-manager-api.lambdatest.com//api/v1/...), resulting in 404 errors that surfaced as CORS / "Failed to fetch" errors in the browser./in their server URL. When concatenated with endpoint paths (which start with/), this produced//in the URL.handleSend()andbuildCurl()inTryItModal.js.Affected APIs
https://test-manager-api.lambdatest.com//api/v1/...→ 404https://test-manager-api.lambdatest.com/api/v1/...→ ✅https://auth.lambdatest.com//api/...→ 404https://auth.lambdatest.com/api/...→ ✅https://audit-logs.lambdatest.com//api/...→ 404https://audit-logs.lambdatest.com/api/...→ ✅Other 9 APIs (Selenium, Screenshots, App Automation, SmartUI, Cypress, HyperExecute, Accessibility, Analytics, Performance) are unaffected — their server URLs had no trailing slash.
Test plan
🤖 Generated with Claude Code