Comment

Lines starting with # or // are comments and are ignored when Visual Studio sends an HTTP request.

variable

Lines starting with @ define variables using the syntax @VariableName=Value.

@hostname=localhost
@port=44320
GET https://{{hostname}}:{{port}}/weatherforecast

multiple requests

The request format is:

[<HTTP-verb>] <url> [<HTTP-version>]
[<request-headers>]
[<request-body>]
GET https://localhost:7220/weatherforecast

###

GET https://localhost:7220/weatherforecast?date=2023-05-11&location=98006

###

GET https://localhost:7220/weatherforecast HTTP/3

###

Request headers

GET https://localhost:7220/weatherforecast
Date: Wed, 27 Apr 2023 07:28:00 GMT

###

GET https://localhost:7220/weatherforecast
Cache-Control: max-age=604800
Age: 100

###

request body

POST https://localhost:7220/weatherforecast
Content-Type: application/json

{
  "date": "2023-05-11",
  "location": "98006"
}

Create an HTTP file using a template

  1. Right-click the ASP.NET Core project
  2. Add > New Item
  3. ASP.NET Core>General
  4. Select HTTP File, then select Add

Use the Endpoint Explorer

View > Other Windows > Endpoint Resource Management