Skip to content

fix(snippetz): send the body in http/http1.1 examples for json media types and text bodies - #10510

Merged
hanspagel merged 1 commit into
scalar:mainfrom
charan-rathore:fix/snippetz-http11-body-media-types
Oct 6, 2026
Merged

hanspagel merged 1 commit into
scalar:mainfrom
charan-rathore:fix/snippetz-http11-body-media-types

Conversation

@charan-rathore

Copy link
Copy Markdown
Contributor

Problem

The raw HTTP/1.1 code example leaves out the request body unless the media type is exactly application/json, application/octet-stream, a url-encoded form or multipart. A body for application/json; charset=utf-8, application/vnd.api+json, text/plain or application/xml is dropped, so the copied request is sent with a Content-Type header and no body.

Solution

Use the existing isJsonMediaType helper from @scalar/helpers for JSON types and keep the media type as written in the header. Any other body that has text is now sent as it is. Output for plain application/json is the same as before.

I added tests for a charset parameter, a +json type and a plain text body. All three fail without the change.

Checklist

  • I explained why the change is needed.
  • I added a changeset.
  • I added tests.
  • I updated the documentation. (not needed, no docs describe this)

@changeset-bot

changeset-bot Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eb5f00e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@scalar/snippetz Patch
@scalar/java-integration Patch
@scalar/api-client Patch
@scalar/api-reference Patch
@scalar/blocks Patch
@scalar/workspace-store Patch
@scalar/nuxt Patch
@scalar/agent-chat Patch
@scalar/api-client-react Patch
scalar-app Patch
@scalarapi/docker-api-reference Patch
@scalar/aspire Patch
@scalar/aspnetcore Patch
@scalar/aws-lambda Patch
@scalar/azure-functions Patch
@scalar/fastify-api-reference Patch
scalar_api_reference Patch
@scalar/api-reference-react Patch
@scalar/server-side-rendering Patch
@scalar/mock-server Patch
@scalar/oas-utils Patch
@scalar/openapi-to-markdown Patch
@scalar/pre-post-request-scripts Patch
@scalar/sidebar Patch
@scalar/mock-server-docker Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@hanspagel
hanspagel force-pushed the fix/snippetz-http11-body-media-types branch from 12c71be to eb5f00e Compare October 6, 2026 12:45
@hanspagel
hanspagel temporarily deployed to production-netlify October 6, 2026 12:46 — with GitHub Actions Inactive
@hanspagel
hanspagel temporarily deployed to production-netlify October 6, 2026 12:46 — with GitHub Actions Inactive
@hanspagel
hanspagel temporarily deployed to production-netlify October 6, 2026 12:46 — with GitHub Actions Inactive
@hanspagel
hanspagel temporarily deployed to production-netlify October 6, 2026 12:46 — with GitHub Actions Inactive
@hanspagel
hanspagel temporarily deployed to production-netlify October 6, 2026 12:46 — with GitHub Actions Inactive
@hanspagel
hanspagel enabled auto-merge (squash) October 6, 2026 12:49
@hanspagel
hanspagel merged commit 2002142 into scalar:main Oct 6, 2026
31 checks passed
@charan-rathore
charan-rathore deleted the fix/snippetz-http11-body-media-types branch October 6, 2026 13:02
@scalar-release-bot scalar-release-bot Bot mentioned this pull request Oct 6, 2026

This branch was previously deployed

1 inactive deployment
production-netlify — eb5f00ec Deployed Oct 6, 2026 by hanspagel via test-e2e-scalar-app #3223
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.

2 participants