diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-03-14 00:57:05 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-03-14 00:57:05 +0900 |
| commit | bf01bb84b6b96fe2cba529f588e29a9038c0daf6 (patch) | |
| tree | 929c8ad8e4ec3eebdae8ffd046f7990b9f6dccae /src/HttpServerBodyCommand.cc | |
| parent | feb4e2e53a368baa64dffd5e2182204548fe86d5 (diff) | |
Added JSONP support. Callback query parameter is "jsoncallback".
Diffstat (limited to 'src/HttpServerBodyCommand.cc')
| -rw-r--r-- | src/HttpServerBodyCommand.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/HttpServerBodyCommand.cc b/src/HttpServerBodyCommand.cc index c60502b1..7577d3eb 100644 --- a/src/HttpServerBodyCommand.cc +++ b/src/HttpServerBodyCommand.cc @@ -213,12 +213,16 @@ bool HttpServerBodyCommand::execute() addHttpServerResponseCommand(); return true; } else if(reqPath == "/jsonrpc") { - // TODO handle query parameter std::string callback; - SharedHandle<ValueBase> json; try { - json = json::decode(httpServer_->getBody()); + if(httpServer_->getMethod() == "GET") { + json::JsonGetParam param = json::decodeGetParams(query); + callback = param.callback; + json = json::decode(param.request); + } else { + json = json::decode(httpServer_->getBody()); + } } catch(RecoverableException& e) { A2_LOG_INFO_EX (fmt("CUID#%lld - Failed to parse JSON-RPC request", |
