1
@Headers("Authorization: " + BuildConfig.CLIENT_ID + " " + BuildConfig.CLIENT_SECRET)
@GET("get/list")
Observable<List<Post>> getList();
裏面的GET文件夾u能找到這樣的.htaccess:(安卓)d/OkHttp:400錯誤的請求
RewriteEngine On
AuthName "Staff Only:3"
AuthType Basic
AuthUserFile .../api/get/.htpasswd
require valid-user
獲取/列表返回崗位的JSON數組。在那個php代碼中沒有400個代碼。我也確定在我的json響應中,它的正確性(由jsonschema2pojo.org確認) 標題(codeblock 1)確實授權我。
而且......
D/OkHttp: --> GET http://*********/api/get/list http/1.1
D/OkHttp: Authorization: r*******m *******6
D/OkHttp: --> END GET
...
D/OkHttp: <-- 400 Bad Request http://*********/api/get/list (18711ms)
D/OkHttp: Date: Sun, 19 Mar 2017 20:13:11 GMT
D/OkHttp: Content-Type: text/html
D/OkHttp: Content-Length: 177
D/OkHttp: Connection: close
D/OkHttp: Server: -nginx
D/OkHttp: CF-RAY: -
D/OkHttp: <html>
D/OkHttp: <head><title>400 Bad Request</title></head>
D/OkHttp: <body bgcolor="white">
D/OkHttp: <center><h1>400 Bad Request</h1></center>
D/OkHttp: <hr><center>cloudflare-nginx</center>
D/OkHttp: </body>
D/OkHttp: </html>
D/OkHttp: <-- END HTTP (177-byte body)
問心無愧?爲什麼?請告訴我最新的問題?你能幫我解決這個問題嗎?
我做了10小時前(我問了這個[2天前俄羅斯的stackoverflow](http://ru.stackoverflow.com/questions/641698/android-d-okhttp-400-bad-request) 。我的PHP以'<?php header(「Content-Type:application/json; charset = utf-8」)開始;' 仍然無法工作 –