0
は、この例を見てみましょう:フォームを送信するときにカールがContent-Typeに追加されます。これを上書きする方法は?
curl http://host.compute-1.amazonaws.com:8080/oauth2/token -H "Content-Type: application/x-www-form-urlencoded" -F 'grant_type=password' -F 'username=test-user' -F 'password=password' -F 'client_id=test_application_client_id' -F 'client_secret=password' -v
一つは、Content-Type
がapplication/x-www-form-urlencoded
に設定されるだろうと思うだろう。代わりにカールを送るapplication/x-www-form-urlencoded; boundary=------------------------5f55da42226c00e5
への道はありませんこれを行うには?カールmanページから
[email protected] ~/ $ curl http://something.compute-1.amazonaws.com:8080/oauth2/token -H "Content-Type: application/x-www-form-urlencoded" -F 'grant_type=password' -F 'username=test-user' -F 'password=password' -F 'client_id=test_application_client_id' -F 'client_secret=password' -v
* Trying 0.0.0.0...
* TCP_NODELAY set
* Connected to something.compute-1.amazonaws.com (0.0.0.0) port 8080 (#0)
> POST /oauth2/token HTTP/1.1
> Host: something.compute-1.amazonaws.com:8080
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Length: 598
> Expect: 100-continue
> Content-Type: application/x-www-form-urlencoded; boundary=------------------------5f55da42226c00e5
>
< HTTP/1.1 100 Continue
< HTTP/1.1 400 Bad Request
< Server: Apache-Coyote/1.1
< Date: Wed, 13 Dec 2017 00:43:13 GMT
< Content-Type: text/plain
< Content-Length: 145
< Connection: close
<
* Closing connection 0
WebApplicationException has been caught, status: 400, message: The Content-Type header is missing on this request you should define: Content-Type