LoginSignup
6
2

More than 3 years have passed since last update.

【Swift】AlamofireでURLRequestValidationFailureReason.bodyDataInGETRequest(14 bytes)が出た

Last updated at Posted at 2020-09-10

AlamofireでAPI周りを実装した時に以下のエラーが出ました。

Alamofire.AFError.urlRequestValidationFailed(reason: Alamofire.AFError.URLRequestValidationFailureReason.bodyDataInGETRequest(14 bytes))

どうやらエンコーディングの方法が違いエラーをはいているようです。
この時に指定していたエンコーディングはJSONEncoding.defaultでした。
これをURLEncoding.defaultに変更することでリクエストは正常に処理されました。

結果的に問題は解決出来たのですが、理由は分からず。。
ちょっと前までJSONEncoding.defaultで正常に動作していた気がするのですが、何か知見のある方コメント頂けると嬉しいです🙏

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2