Skip to content

fix(snippetz): keep multiline strings and odd names valid in clj-http examples - #10507

Merged
hanspagel merged 1 commit into
scalar:mainfrom
charan-rathore:fix/snippetz-clj-http-multiline
Oct 6, 2026
Merged

hanspagel merged 1 commit into
scalar:mainfrom
charan-rathore:fix/snippetz-clj-http-multiline

Conversation

@charan-rathore

Copy link
Copy Markdown
Contributor

Problem

Two things make the clj-http code example wrong or invalid Clojure:

  • A body or JSON value that has a line break is written with a real new line inside the string. The example then adds indentation after each new line to line up the map, so that indentation becomes part of the string. The copied request sends a different body (extra spaces on every line).
  • Header, query and form names are always written as keywords. A name like X Custom or filter[name] gives :X Custom, which is not valid Clojure.

Solution

Write line breaks as \n and \r escapes, so the layout padding can never end up inside a string. Names that are not valid keywords are written as string keys, which clj-http accepts for headers, query params and form params. Normal names still render as :name.

One existing test expected :special chars!@#, which is not valid Clojure, so I updated it to "special chars!@#". I added tests for a multiline text body, a multiline JSON value and header and query names with spaces and brackets. They fail without the fix.

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: 63f2f87

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-clj-http-multiline branch from ad30e98 to 63f2f87 Compare October 6, 2026 10:29
@hanspagel
hanspagel temporarily deployed to production-netlify October 6, 2026 10:32 — with GitHub Actions Inactive
@hanspagel
hanspagel temporarily deployed to production-netlify October 6, 2026 10:32 — with GitHub Actions Inactive
@hanspagel
hanspagel temporarily deployed to production-netlify October 6, 2026 10:32 — with GitHub Actions Inactive
@hanspagel
hanspagel temporarily deployed to production-netlify October 6, 2026 10:32 — with GitHub Actions Inactive
@hanspagel
hanspagel temporarily deployed to production-netlify October 6, 2026 10:32 — with GitHub Actions Inactive
@hanspagel
hanspagel merged commit 3314c9c into scalar:main Oct 6, 2026
32 checks passed
@charan-rathore
charan-rathore deleted the fix/snippetz-clj-http-multiline branch October 6, 2026 10:39
charan-rathore added a commit to charan-rathore/charan-rathore that referenced this pull request Oct 6, 2026
@scalar-release-bot scalar-release-bot Bot mentioned this pull request Oct 6, 2026

This branch was previously deployed

1 inactive deployment
production-netlify — 63f2f87b Deployed Oct 6, 2026 by hanspagel via test-cdn-snapshots #3216
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