Tuesday, 15 September 2015

c# - ServiceStack DELETE request is default object, POST works fine -



c# - ServiceStack DELETE request is default object, POST works fine -

i have dto coming javascript client. when seek send deletefromservice request object empty (looks new-ed up). if alter method posttoservice request object populated properly.

i using 3.9 api. @ loss here.

service:

public object post(order request) { homecoming _orderrepository.insertorder(request); } public object delete(order request) { _orderrepository.deleteorder(request.uuid); homecoming true; }

js:

//fails serviceclient.deletefromservice("order", order, function () { }, deletefailed); //works serviceclient.posttoservice("order", order, function () { }, deletefailed);

update:

i found issue in servicestack source code. treating delete , creating request object instead of body, post.

if (httpmethod == httpmethods.get || httpmethod == httpmethods.delete || httpmethod == httpmethods.options) { seek { homecoming keyvaluedatacontractdeserializer.instance.parse(querystring, operationtype); } }

the problem doing this, servicestack js client creates delete request using same logic post, stuffing info send body (technically jquery xhr data prop), meaning there no way server message client sending.

am reading right? js client's delete broken?

i rewrote servicestack.js client adding next line in p.send function before options var initialization...

if (ajaxoptions.type === "delete") { requesturl = requesturl + "?" + decodeuricomponent($.param(request[webmethod])); }

c# servicestack

No comments:

Post a Comment