I am adding header in httprequest but on server none of the parameter received. please guide me if i am doing mistake in adding header.my current cocos2dx version is 3.4
@iQD thanks for reply. i removed spaces but result is same,yes i set request type to delete, because i am deleting data. please clarify header type or request type ?
but server required Delete type from client side.I used put and post in client side to check the behaviour but same response from server side. no header data received in server side
As I can see, it’s implemented in the enum and as it’s using curl, it should not be a problem.
IIRC 3.9 dropped curl and is using the native functions.
/**
* The HttpRequest type enum used in the HttpRequest::setRequestType.
*/
enum class Type
{
GET,
POST,
PUT,
DELETE,
UNKNOWN,
};
@iQD same enum are available for 3.4 but header param not attaching in request call.I don’t know what mistake i am doing.I want to know if headers are working in 3.8 then i can take chance to move from 3.4 to 3.8
this is my request call.kindly go through and let me know if i am doing mistake in adding headers.
cocos2d::network::HttpRequest* request = new cocos2d::network::HttpRequest();
if (headerparam != nullptr) {
request->setRequestType(cocos2d::network::HttpRequest::Type::DELETE);
}
else
{
request->setRequestType(cocos2d::network::HttpRequest::Type::POST);
}
Thanks @iQD but problem is my server is written in rubby on rail, i used same parameter that you mention above but i get in response nothing from server side, server guy told me he did not received any parameter form client side in header.
Try using python or php to verify. If you can get the headers via python or php, then the problem is not with your frontend code. Your server guy probably needs to check his side.
same parameter i set in advanced rest client to verify delete call. it works on rest client.its mean no issue is with server side.One thing i see in HttpClient-ios.mm class he did not handling Delete request to add parameter in header file. can you guys tell me cocos2dx guy so i contact them directly via email. your help will be appreciated.thanks in advance.