Skip to content

CURL

Last updated View as MarkdownAgent setup

The CURL component is used 63 times on 24 pages.

See all examples of pages that use CURL

Used 63 times.

Pages

Partials

The CURL component is used to display a cURL command for making HTTP requests.

Import

import { CURL } from "~/components";

Usage

import { CURL } from "~/components";

<CURL
	url="https://httpbin.org/anything"
	method="POST"
	json={{
		key: "va'l'ue",
	}}
	query={{
		foo: "bar",
		bar: ["baz", "qux"],
	}}
	code={{
		mark: "value",
	}}
/>

<CURL
	url="https://httpbin.org/anything"
	method="POST"
	form={{
		key: "value",
	}}
	code={{
		mark: "value",
	}}
/>

<CURL> Props

url

required

type: string

The URL to make the request to.

method

type: "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "OPTIONS" | "PATCH"

default: "GET"

The HTTP method to use for the request.

headers

type: Record<string, string>

The headers to include in the request.

json

type: Record<string, any> | Record<string, any>[]

JSON data to include in the request.

form

type: Record<string, any>

The FormData payload to send.

query

type: Record<string, string | string[]>

URL query parameters to append to the request URL.

code

type: object

An object of Astro Code props. Refer to the Astro Code component documentation for available props.

Was this helpful?