Skip to content

Copy code sample button omits HTTP request line #720

@leemthompo

Description

@leemthompo

Describe the bug

The copy button in code samples is not capturing the complete request when there's a JSON payload. The HTTP method and endpoint path are chopped off.

Current behavior

  • Only JSON body is copied
  • HTTP request/endpoint line is lost

Example

What appears in docs:

Image

What gets copied:

{
  "mappings": {
    "properties": {
      "content": { 
        "type": "semantic_text" 
      }
    }
  }
}

Expected behavior

  • Complete request should be copied, including:
    • HTTP method (PUT, GET, etc.)
    • Endpoint path
    • JSON body

Steps to reproduce

  1. Navigate to documentation page with REST API examples, for example
  2. Find a code sample that includes JSON payload
  3. Click the copy button
  4. Paste the copied content

Environment

  • Browser: Chrome, Safari, Firefox
  • OS: macOS

Tooling

  • docs-builder
  • migration tooling
  • I'm not sure

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions