var AWS = require('../core'); var inherit = AWS.util.inherit; /** * @api private */ AWS.ServiceInterface.Query = { buildRequest: function buildRequest(req) { var operation = req.service.api.operations[req.operation]; var httpRequest = req.httpRequest; httpRequest.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8'; httpRequest.params = { Version: req.service.api.apiVersion, Action: operation.name }; // convert the request parameters into a list of query params, // e.g. Deeply.NestedParam.0.Name=value var rules = operation.input; if (rules) rules = rules.members; var builder = new AWS.QueryParamSerializer(rules, req.service.api); builder.serialize(req.params, function(name, value) { httpRequest.params[name] = value; }); httpRequest.body = AWS.util.queryParamsToString(httpRequest.params); }, extractError: function extractError(resp) { var data, body = resp.httpResponse.body.toString(); if (body.match('