---
title: "standard-http-method-constant"
description: "Prefer net/http method constants."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# standard-http-method-constant

**Default severity:** `warning`

Reports hardcoded standard methods passed to `http.NewRequest` and
`http.NewRequestWithContext`. Use constants such as `http.MethodGet` to make
protocol intent explicit.

## Bad

```go
request, err := http.NewRequest("GET", endpoint, nil)
```

## Good

```go
request, err := http.NewRequest(http.MethodGet, endpoint, nil)
```

Source: https://strider.gempir.com/analyzers/standard-http-method-constant/index.mdx
