mirror of https://github.com/axmolengine/axmol.git
Fixed check for arguments at xhr.send()
This commit is contained in:
parent
89fc8168e5
commit
4cb3001fc6
|
@ -616,19 +616,19 @@ JS_BINDED_FUNC_IMPL(MinXmlHttpRequest, send)
|
|||
{
|
||||
|
||||
JSString *str;
|
||||
char *data;
|
||||
|
||||
// Clean up header map. New request, new headers!
|
||||
http_header.clear();
|
||||
|
||||
if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &str)) {
|
||||
return JS_FALSE;
|
||||
};
|
||||
|
||||
if (meth.compare("post") == 0 || meth.compare("POST") == 0) {
|
||||
|
||||
char *data = JS_EncodeString(cx, str);
|
||||
cc_request->setRequestData(data, strlen(data));
|
||||
if (argc == 2) {
|
||||
if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &str)) {
|
||||
return JS_FALSE;
|
||||
};
|
||||
data = JS_EncodeString(cx, str);
|
||||
}
|
||||
|
||||
if (meth.compare("post") == 0 || meth.compare("POST") == 0) {
|
||||
cc_request->setRequestData(data, strlen(data));
|
||||
}
|
||||
|
||||
_setHttpRequestHeader();
|
||||
|
|
Loading…
Reference in New Issue