Home Explore Blog CI



nushell

1st chunk of `commands/docs/http_options.md`
0a14a9945342dd44a0ebcbad597f99bf622c4bf7b9a238ea0000000100000810
---
title: http options
categories: |
  network
version: 0.104.0
network: |
  Requests permitted communication options for a given URL.
usage: |
  Requests permitted communication options for a given URL.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `http options` for [network](/commands/categories/network.md)

<div class='command-title'>Requests permitted communication options for a given URL.</div>

## Signature

```> http options {flags} (URL)```

## Flags

 -  `--user, -u {any}`: the username when authenticating
 -  `--password, -p {any}`: the password when authenticating
 -  `--max-time, -m {duration}`: max duration before timeout occurs
 -  `--headers, -H {any}`: custom headers you want to add
 -  `--insecure, -k`: allow insecure server connections when using SSL
 -  `--allow-errors, -e`: do not fail if the server returns an error code

## Parameters

 -  `URL`: The URL to fetch the options from.


## Input/output types:

| input   | output |
| ------- | ------ |
| nothing | any    |
## Examples

Get options from example.com
```nu
> http options https://www.example.com

```

Get options from example.com, with username and password
```nu
> http options --user myuser --password mypass https://www.example.com

```

Get options from example.com, with custom header
```nu
> http options --headers [my-header-key my-header-value] https://www.example.com

```

Get options from example.com, with custom headers
```nu
> http options --headers [my-header-key-A my-header-value-A my-header-key-B my-header-value-B] https://www.example.com

```

Simulate a browser cross-origin preflight request from www.example.com to media.example.com
```nu
> http options https://media.example.com/api/ --headers [Origin https://www.example.com Access-Control-Request-Headers "Content-Type, X-Custom-Header" Access-Control-Request-Method GET]

```

## Notes
Performs an HTTP OPTIONS request. Most commonly used for making CORS preflight requests.

Title: http options command
Summary
The `http options` command in Nushell is used to request the communication options available for a given URL, typically for CORS preflight requests. It supports flags for authentication, setting a maximum timeout, adding custom headers, allowing insecure SSL connections, and ignoring server errors. The command takes a URL as input and outputs the available options.