.Dd January 30, 2023 .Dt HTTP 1 .Os .Sh NAME .Nm http .Nd HTTP(s) request utility .Sh SYNOPSIS .Nm .Op Fl vnsiIrhV .Op Fl H Ar header .Op Fl t Ar content-type .Op Fl a Ar accept .Ar method url .Op Ar body .Sh DESCRIPTION The .Nm utility performs an HTTP or HTTPS request to .Ar url using the specified request .Ar method and prints the response body to the standard output. If the standard output is a tty, .Nm will attempt to pretty print the response body if the Content-Type header indicates a supported content type. .Pp .Ar method may be one of \fBget\fR, \fBhead\fR, \fBpost\fR, \fBput\fR, \fBdelete\fR, \fBoptions\fR, and \fBpatch\fR. .Pp If .Ar url is not prefixed with \fBhttp://\fR, the protocol is guessed automatically based on whether the program was called as \fBhttp\fR or \fBhttps\fR. If .Ar body is a single dash .Pq Sq Fl , it is read from the standard input. .Sh OPTIONS Mandatory arguments to long options are mandatory for short options too. .Bl -tag -width flag .It Fl a , Fl \-accept Ar type Shortcut for quickly specifying the Accept header. .It Fl h , Fl \-help Show a brief help summary and exit. .It Fl H , Fl \-header Ar header Add an additional request header in the form "\fIname\fR: \fIvalue\fR", with or without a space after the colon. May be specified more than once. Note: Shells usually require enclosing the argument in quotes if the space is present, as it would otherwise interpret \fIvalue\fR as a separate parameter. .It Fl i , \-include\-headers Print HTTP response headers. .It Fl I , \-headers Only print HTTP response headers. .It Fl n , \-nofollow Do not automatically follow HTTP redirects (3xx status codes). .It Fl r , Fl \-raw Never pretty-print the body. This is the default if the standard output is not a tty. .It Fl s Print the HTTP version, status code, and status name. .It Fl t , Fl \-content-type Ar type Shortcut for quickly specifying the Content\-Type header. .It Fl v Be verbose. This prints the HTTP version and the response's status code, and logs every redirect. .It Fl V Print version information and exit. .Sh "EXIT STATUS" The .Nm utility exits 0 on success, 1 if a network error occurred or illegal arguments were supplied, and 2 if the response was invalid or indicated a failure (4xx and 5xx status codes). .Sh "SEE ALSO" .Xr curl 1 , .Xr wget 1 .Sh BUGS None. :)