CURL コンポーネントは、HTTP リクエスト用の cURL コマンドを表示します。
import { CURL } from "~/components";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",
}}
/>required
type: string
リクエスト先の URL です。
type: "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "OPTIONS" | "PATCH"
default: "GET"
リクエストに使う HTTP メソッドです。
type: Record<string, string>
リクエストに含めるヘッダーです。
type: Record<string, any> | Record<string, any>[]
リクエストに含める JSON データです。
type: Record<string, any>
送信する FormData ペイロードです。
type: Record<string, string | string[]>
リクエスト URL に付ける URL クエリパラメーターです。
type: object
Astro の Code props のオブジェクトです。利用できる props は Astro の Code コンポーネントのドキュメント ↗ を参照してください。