alpacahq / alpacahq/Alpaca-API

Endpoints should return 308 status rather than 301 on POST requests

Đang mở
#134 2 bình luận 2 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
173
Fork
17
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Currently, the api issues a 301 response if a request arrives with a `http` scheme as opposed to an `https` scheme. The 301 status works fine for `GET` requests and forwards the request correctly, but for some user-agents a 301 status leads to a `POST` request being changed to a `GET` request.

A `308` response serves the same purpose as a `301`, but leaves the method of the request intact, meaning that the `POST` request is served correctly. Here's a cURL request that you can try out:
```curl
curl -L -X POST -H "apca-api-key-id: KEY_ID_HERE" -H "apca-api-secret-key: SECRET_KEY_HERE" -H "Content-Type: application/json" --data '{"symbol":"V","qty":"1","side":"buy","type":"market","time_in_force":"gtc"} http://paper-api.alpaca.markets/v2/orders'
```
Because of the 301 status, the POST method in that request gets clobbered into a GET method after the redirect and we get an error

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.