Karve app icon

Karve

ASP.NET Core aspnet-core-validation-errors.http

ASP.NET Core validation errors .http example

Keep deliberately invalid requests beside the API so validation behavior remains easy to reproduce.

aspnet-core-validation-errors.http

@baseUrl = https://localhost:7001

### Trigger an empty-field validation error
POST {{baseUrl}}/users
Accept: application/problem+json
Content-Type: application/json

{
  "name": "",
  "email": "not-an-email"
}

### Trigger a range validation error
POST {{baseUrl}}/products
Accept: application/problem+json
Content-Type: application/json

{
  "name": "Sample",
  "price": -1
}

Variables to replace

baseUrl
Your ASP.NET Core HTTPS launch URL.

Expected response

APIs using ASP.NET Core validation commonly return 400 Bad Request with application/problem+json and an errors object. Custom endpoint filters may return a different documented status.

Related examples and guides

Learn the full syntax in the .http file format guide, manage secrets with variables and environments, or see how to run .http files on Windows.

Launch Summer Sale

Run this request without leaving Windows.

Karve opens .http files as a native workspace: edit the plain text, press Run, inspect the response, and keep the file in Git.

15-day free trial · No account · No subscription · No metered requests

25% off until Sep 1