Skip to content

fix(explorer): encode RFC 3986 reserved chars in query parameter values#1366

Merged
sserrata merged 2 commits intomainfrom
fix/rfc3986-query-param-encoding
Mar 30, 2026
Merged

fix(explorer): encode RFC 3986 reserved chars in query parameter values#1366
sserrata merged 2 commits intomainfrom
fix/rfc3986-query-param-encoding

Conversation

@sserrata
Copy link
Copy Markdown
Member

Summary

  • Query parameter values were only encoding whitespace (replace(/\s/g, "%20")), leaving RFC 3986 reserved characters like : unencoded in request URLs
  • Replaces the space-only encoding with encodeURIComponent for query parameters, which correctly percent-encodes all reserved characters (e.g. :%3A)
  • Path parameters retain existing whitespace-only encoding — they are handled separately downstream in setPathParams and changing them is out of scope

Test plan

  • Enter a query parameter value containing : (e.g. foo:bar) in the Try It panel — confirm the request URL shows foo%3Abar
  • Confirm spaces still encode as %20
  • Confirm other reserved characters (/, ?, #, @) are encoded correctly
  • Confirm existing query parameters with plain alphanumeric values are unaffected

Closes #1312

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

Size Change: +3.08 kB (+0.14%)

Total Size: 2.21 MB

Filename Size Change
demo/.docusaurus/globalData.json 66.5 kB +428 B (+0.65%)
demo/.docusaurus/registry.js 96.4 kB +613 B (+0.64%)
demo/.docusaurus/routes.js 91.1 kB +560 B (+0.62%)
demo/.docusaurus/routesChunkNames.json 37.8 kB +241 B (+0.64%)
demo/build/assets/js/main.********.js 659 kB +1.14 kB (+0.17%)
demo/build/assets/js/runtime~main.********.js 22.6 kB +98 B (+0.44%)
ℹ️ View Unchanged
Filename Size
demo/.docusaurus/codeTranslations.json 2 B
demo/.docusaurus/docusaurus.config.mjs 14.7 kB
demo/.docusaurus/i18n.json 372 B
demo/.docusaurus/site-metadata.json 1.51 kB
demo/build/assets/css/styles.********.css 164 kB
demo/build/index.html 97.6 kB
demo/build/petstore/add-pet/index.html 29.3 kB
demo/build/petstore/create-user/index.html 24 kB
demo/build/petstore/create-users-with-array-input/index.html 24.1 kB
demo/build/petstore/create-users-with-list-input/index.html 24.1 kB
demo/build/petstore/delete-order/index.html 23.8 kB
demo/build/petstore/delete-pet/index.html 24.1 kB
demo/build/petstore/delete-user/index.html 24.3 kB
demo/build/petstore/find-pets-by-status/index.html 24.8 kB
demo/build/petstore/find-pets-by-tags/index.html 25.4 kB
demo/build/petstore/get-inventory/index.html 23.1 kB
demo/build/petstore/get-order-by-id/index.html 24.1 kB
demo/build/petstore/get-pet-by-id/index.html 24.9 kB
demo/build/petstore/get-user-by-name/index.html 24.4 kB
demo/build/petstore/login-user/index.html 24.9 kB
demo/build/petstore/logout-user/index.html 23.7 kB
demo/build/petstore/new-pet/index.html 24.3 kB
demo/build/petstore/pet/index.html 22.5 kB
demo/build/petstore/place-order/index.html 23.3 kB
demo/build/petstore/schemas/apiresponse/index.html 24.6 kB
demo/build/petstore/schemas/cat/index.html 38.7 kB
demo/build/petstore/schemas/category/index.html 25.7 kB
demo/build/petstore/schemas/dog/index.html 39 kB
demo/build/petstore/schemas/honeybee/index.html 39.1 kB
demo/build/petstore/schemas/id/index.html 22.7 kB
demo/build/petstore/schemas/order/index.html 26.8 kB
demo/build/petstore/schemas/pet/index.html 38.5 kB
demo/build/petstore/schemas/tag/index.html 24.1 kB
demo/build/petstore/schemas/user/index.html 40.6 kB
demo/build/petstore/store/index.html 21.5 kB
demo/build/petstore/subscribe-to-the-store-events/index.html 30.2 kB
demo/build/petstore/swagger-petstore-yaml/index.html 30.2 kB
demo/build/petstore/update-pet-with-form/index.html 24.3 kB
demo/build/petstore/update-pet/index.html 24.7 kB
demo/build/petstore/update-user/index.html 24.3 kB
demo/build/petstore/upload-file/index.html 24.1 kB
demo/build/petstore/user/index.html 22.2 kB

compressed-size-action

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

Visit the preview URL for this PR (updated for commit 8dfb121):

https://docusaurus-openapi-36b86--pr1366-3gmrbigi.web.app

(expires Wed, 29 Apr 2026 18:32:35 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

Replaces the manual space-only encoding with encodeURIComponent for query
parameters, so reserved characters like ':' are correctly percent-encoded
(e.g. ':' → '%3A') when building request URLs.

Path parameters retain the existing whitespace-only encoding since they
are handled separately downstream in setPathParams.

Closes #1312
@sserrata sserrata force-pushed the fix/rfc3986-query-param-encoding branch from 5932d60 to aa6a722 Compare March 30, 2026 18:27
…lization

Adds two endpoints to visually verify that reserved characters like ':', '/',
and '#' are percent-encoded in query parameter values.

Related to #1312
@sserrata sserrata merged commit 5fdee72 into main Mar 30, 2026
11 checks passed
@sserrata sserrata deleted the fix/rfc3986-query-param-encoding branch March 30, 2026 19:12
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.

RFC 3986 support for query parameters

1 participant