From 0a10c542d9220066e5e071a85876c861dd6b3e27 Mon Sep 17 00:00:00 2001 From: Zachary Carter <zack.carter@gmail.com> Date: Thu, 28 Jun 2012 16:34:35 -0700 Subject: [PATCH] Requests for internal wsapis return 404 --- lib/wsapi.js | 2 +- tests/internal-wsapi-test.js | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 tests/internal-wsapi-test.js diff --git a/lib/wsapi.js b/lib/wsapi.js index 4e5452a57..b9c5b50f7 100644 --- a/lib/wsapi.js +++ b/lib/wsapi.js @@ -346,7 +346,7 @@ exports.routeSetup = function (app, options) { } if (api.internal) { - return httputils.badRequest(resp, "internal api"); + return httputils.notFound(resp); } var destination_url = api.writes_db ? options.write_url + "/wsapi/" + operation diff --git a/tests/internal-wsapi-test.js b/tests/internal-wsapi-test.js new file mode 100644 index 000000000..59d04ae2d --- /dev/null +++ b/tests/internal-wsapi-test.js @@ -0,0 +1,35 @@ +#!/usr/bin/env node + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +require('./lib/test_env.js'); + +const +assert = require('assert'), +vows = require('vows'), +start_stop = require('./lib/start-stop.js'), +wsapi = require('./lib/wsapi.js'); + +var suite = vows.describe('internal-wsapi'); + +// disable vows (often flakey?) async error behavior +suite.options.error = false; + +start_stop.addStartupBatches(suite); + +suite.addBatch({ + "requesting to create an account with an assertion": { + topic: wsapi.post('/wsapi/create_account_with_assertion', { }), + "returns a 404": function(err, r) { + assert.strictEqual(r.code, 404); + } + } +}); + +start_stop.addShutdownBatches(suite); + +// run or export the suite. +if (process.argv[1] === __filename) suite.run(); +else suite.export(module); -- GitLab