跳转到内容
搜索文档

CURL

最后更新 查看 MarkdownAgent 设置

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",
	}}
/>

<CURL> 属性

url

必需

类型: string

发起请求的 URL。

method

类型: "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "OPTIONS" | "PATCH"

默认值: "GET"

请求要使用的 HTTP 方法。

headers

类型: Record<string, string>

请求中要包含的标头。

json

类型: Record<string, any> | Record<string, any>[]

请求中要包含的 JSON 数据。

form

类型: Record<string, any>

要发送的 FormData 负载。

query

类型: Record<string, string | string[]>

要附加到请求 URL 的 URL 查询参数。

code

类型: object

Expressive Code 属性的对象,以下属性可用:

这篇文档对您有帮助吗?