Yoji SHIDARA
null+****@clear*****
Wed Oct 10 15:40:03 JST 2012
Yoji SHIDARA 2012-10-10 15:40:03 +0900 (Wed, 10 Oct 2012) New Revision: defa29447691456013f3a854e4501d1be95c4e10 https://github.com/groonga/gcs/commit/defa29447691456013f3a854e4501d1be95c4e10 Log: Remove presence validation of Version Modified files: lib/api/2011-02-01/configuration.js test/api-configuration.test.js Modified: lib/api/2011-02-01/configuration.js (+5 -9) =================================================================== --- lib/api/2011-02-01/configuration.js 2012-10-10 13:44:49 +0900 (150e77c) +++ lib/api/2011-02-01/configuration.js 2012-10-10 15:40:03 +0900 (2df62b0) @@ -512,16 +512,12 @@ exports.createHandler = function(context, config) { if (!action) return next(); + // ACS document says "The API version must be specified in all requests." + // but actual implementation of ACS accepts configuration requests + // without Version specification. + // See http://docs.amazonwebservices.com/cloudsearch/latest/developerguide/ConfigAPI.html var version = request.query.Version; - if (!version) { - message = 'An input parameter "Version" that is mandatory for ' + - 'processing the request is not supplied.'; - body = createCommonErrorResponse('MissingParameter', message); - response.contentType('application/xml'); - return response.send(body, 400); - } - - if (version != exports.version) { + if (version && version != exports.version) { message = 'A bad or out-of-range value "' + version + '" was supplied ' + 'for the "Version" input parameter.'; body = createCommonErrorResponse('InvalidParameterValue', message); Modified: test/api-configuration.test.js (+0 -23) =================================================================== --- test/api-configuration.test.js 2012-10-10 13:44:49 +0900 (65f9d20) +++ test/api-configuration.test.js 2012-10-10 15:40:03 +0900 (6c3cf33) @@ -842,29 +842,6 @@ suite('Configuration API', function() { setup(commonSetup); teardown(commonTeardown); - test('no version', function(done) { - utils - .get('/?Action=unknown') - .next(function(response) { - response = xmlResponses.toParsedResponse(response); - assert.deepEqual(response.pattern, - { statusCode: 400, - body: xmlResponses.COMMON_ERROR_RESPONSE }); - - var expectedError = { - Code: 'MissingParameter', - Message: 'An input parameter "Version" that is mandatory for ' + - 'processing the request is not supplied.' - }; - assert.deepEqual(response.body.Response.Errors.Error, expectedError); - - done(); - }) - .error(function(error) { - done(error); - }); - }); - test('invalid version', function(done) { utils .get('/?Version=2011-02-02&Action=unknown') -------------- next part -------------- HTML����������������������������...Download