.http files at compile time and reports diagnostics for issues it encounters.
This page documents all diagnostic rules and provides guidance on resolving them.
Overview
DOTHTTP001
HTTP request line errorDetails
Description
This error occurs when the parser cannot interpret the HTTP request line. The request line must follow the format:METHOD URL [HTTP/version]
Cause
Common causes include:- Missing HTTP method (GET, POST, PUT, DELETE, etc.)
- Missing URL
- Invalid URL format
- Malformed HTTP version specifier
How to Fix
Ensure your request line follows the correct format:DOTHTTP002
HTTP header errorDetails
Description
This error occurs when an HTTP header line cannot be parsed correctly.Cause
Common causes include:- Missing colon separator between header name and value
- Invalid header name characters
- Header placed after request body
How to Fix
Headers must use the formatHeader-Name: value and appear before the request body:
DOTHTTP003
HTTP variable errorDetails
Description
This error occurs when a variable definition or reference is malformed.Cause
Common causes include:- Unclosed variable reference (
{{variablewithout closing}}) - Invalid variable name syntax
- Malformed variable definition line
How to Fix
Variable definitions use@name = value syntax, and references use {{name}}:
DOTHTTP004
HTTP body warningDetails
Description
This warning indicates a potential issue with the request body that may cause unexpected behavior but does not prevent parsing.Cause
Common causes include:- Request body on a GET request (unusual but technically allowed)
- Body without corresponding Content-Type header
- Possible JSON syntax issues
How to Fix
Consider adding appropriate headers and reviewing the body content:DOTHTTP005
Unknown HTTP methodDetails
Description
This warning is reported when the HTTP method is not one of the standard methods. The request will still be processed, but using non-standard methods may cause issues with some servers.Standard Methods
The following HTTP methods are recognized without warning:GET,POST,PUT,DELETE,PATCHHEAD,OPTIONS,TRACE,CONNECT
Custom Methods
If you need to use a custom HTTP method (some APIs use them), you can safely ignore this warning. The request will be generated with the custom method.Suppressing Diagnostics
If you need to suppress a diagnostic, you can use standard suppression techniques:In Code
In Project File
In EditorConfig
Suppressing errors (DOTHTTP001-003) is not recommended as they indicate parsing failures that will prevent test generation.
Related Resources
.http File Testing
Learn how to write tests using the .http file format
DotHttp API Reference
Full API documentation for the DotHttp library