django rest framework - Append trailing slash to cURL file upload -


i'm using curl test rest api of django app (apache server) uses django rest framework. problem i'm encountering upload url requires trailing slash, using following curl approach not append trailing slash:

curl -i -b cookie.txt -x put -t "somefile.txt" http://myserver/api/upload/ 

from curl man know:

if there no file part in specified url, curl append local file name. note must use trailing / on last directory prove curl there no file name or curl think last directory name remote file name use.

however, curl doesn't put trailing slash after filename automatically appends. so, can't find way curl make url http://myserver/api/upload/somefile.txt/ instead of http://myserver/api/upload/somefile.txt

any advice?

i got answer curl users mailing list (curl-users@cool.haxx.se):

when doing http put, you're supposed identify resource you're create request. claim api requires have trailing slash bit on broken side.

but no, curl cannot send put such url in easy way can think of. libcurl can of course though, simple fix write simple program in language libcurl binding.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -