Back to Oh My Posh

HTTP

website/docs/segments/web/http.mdx

29.12.01.4 KB
Original Source

What

HTTP Request is a simple segment to return any json data from any HTTP call.

Sample Configuration

import Config from "@site/src/components/Config.js";

<Config data={{ type: "http", style: "diamond", foreground: "#ffffff", background: "#c386f1", leading_diamond: "\ue0b6", trailing_diamond: "\uE0B0", template: "{{ .Result }}", options: { url: "https://jsonplaceholder.typicode.com/posts/1", method: "GET", }, }} />

Options

NameTypeDefaultDescription
urlstring``The HTTP URL you want to call, supports templates
methodstringGETThe HTTP method to use, GET or POST
http_timeoutint10000The timeout in milliseconds for the HTTP request

Template (info)

:::note default template

template
 {{ .Body }}

:::

Properties

NameTypeDescription
.Body.propertystringReplace .property with the property you want to display