0
我已成立了Shopify網站的API密鑰和能夠做一個GET請求,請求用下面的代碼Shopify無法授權使用WS提出API請求
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet get = new HttpGet("https://75da...:[email protected]/admin/products.json");
response = httpClient.execute(get);
以上是在JUnit測試並使用Apache httpcomponents客戶端4.2.3和httpcomponents核心4.2.4
隨着我使用WS.url()嘗試同樣的參數,但我得到的401迴應 - 在身體擅自改動消息
[API]無效的API密鑰或訪問令牌(無法識別的登錄名或密碼錯誤)
我在JUnit測試中使用的代碼:
WSRequestHolder requestHolder = WS.url("https://75da...:[email protected]/admin/products.json");
Promise<Response> promise = requestHolder.get();
Response response = promise.get();
我使用2.1.3播放。
所以差異是使用Apache vs WS,我想一些配置是必需的WS。任何人都可以提供一些見解嗎?
謝謝
嘗試使用wireshark查看請求是否看起來很腥? – johanandren