title: How to add if statement for the request doesn't contain header then reject
body: <p>This is my API Handler for handling the request, I am trying to add if statement which checks that if it contain header with a token if not then reject, basically I have to read header here.</p>
  <pre><code>func getLeads(w http.ResponseWriter, r *http.Request) {
      //if the request doesn't contain header then reject
       if r.Header.Get(&quot;Content-Type&quot;) = nil {
          fmt.Println(&quot;Request Rejected&quot;)
          return
      }
      w.Header().Set(&quot;Content-Type&quot;, &quot;application/json&quot;)
      var leads []Lead
      db, err := getDB()
      if err != nil {
          log.Println(err)
      }
  
      db.Find(&amp;leads)
      // todo: error handling
      json.NewEncoder(w).Encode(leads)
  }
  </code></pre>