{
  "id": "go/http-client-do-with-nil-body",
  "signature": "http: nil body in request",
  "signature_zh": "http: 请求中的body为nil",
  "regex": "http:\\ nil\\ body\\ in\\ request",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Passing a nil body to http.NewRequest or http.Client.Do, which is not allowed; use http.NoBody instead.",
  "root_cause_type": "generic",
  "root_cause_zh": "向http.NewRequest或http.Client.Do传递nil body，不允许；应使用http.NoBody。",
  "versions": [
    {
      "version": "1.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Still creates a non-nil body that may send Content-Length: 0",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Panics occur",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "req, _ := http.NewRequest(\"GET\", url, nil) // nil is fine for GET",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use http.NoBody explicitly: http.NewRequest(\"POST\", url, http.NoBody)",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}