Utilities for a JSON-based API.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

14 行
312 B

  1. package impart
  2. import (
  3. "mime"
  4. "net/http"
  5. )
  6. // ReqJSON returns whether or not the given Request is sending JSON, based on
  7. // the Content-Type header being application/json.
  8. func ReqJSON(r *http.Request) bool {
  9. ct, _, _ := mime.ParseMediaType(r.Header.Get("Content-Type"))
  10. return ct == "application/json"
  11. }