リクエストエンドポイント認証を実装しようとしています。そのために、リクエスト ヘッダーから accessToken 値にアクセスしたいと考えています。
私のGETリクエストのエンドポイントは
CURL コマンド
curl -X GET \
'http://localhost:3000/hello?id=10' \
-H 'accesskey: 23423sfsdfsdfsfg' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: f69b34e6-4888-ec31-5fbc-b734e176571b' \
-d '{
"artwork": {id" : 1}
}'
HTTP コマンド
GET /hello?id=10 HTTP/1.1
Host: localhost:3000
Content-Type: application/json
accessKey: 23423sfsdfsdfsfg
Cache-Control: no-cache
Postman-Token: b974719d-5e1d-4d68-e910-e9ca50562b2f
GET メソッドを実装するための私のコード
(defapi app
(GET ["/hello/:id", :id #"[0-9]+" ] [id]
(log/info "Function begins from here")
(def artworkData (logic/artwork-id (->> id (re-find #"\d+") Long/parseLong)))
(def data (if (not-empty artworkData)
{:data artworkData :status 200}
{:data [] :status 201}))
(ok data)))
accessKey: 23423sfsdfsdfsfg
リクエストヘッダーから取得したい。
値を取得して GET メソッドで使用する方法はありますか?
POSTMAN を使用してすべての API エンドポイントをテストしています。