How to use the http-status-codes.MOVED_TEMPORARILY function in http-status-codes

To help you get started, we’ve selected a few http-status-codes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github electrode-io / electrode / packages / electrode-react-webapp / lib / http-status.js View on Github external
"use strict";

const HttpStatusCodes = require("http-status-codes");

module.exports = {
  // Status codes where we want to redirect the user
  redirect: {
    [HttpStatusCodes.MOVED_PERMANENTLY]: true,
    [HttpStatusCodes.MOVED_TEMPORARILY]: true,
    [HttpStatusCodes.PERMANENT_REDIRECT]: true,
    [HttpStatusCodes.TEMPORARY_REDIRECT]: true
  }
};
github pencilblue / pencilblue / test / include / http / middleware / index.spec.js View on Github external
it('should set the end time on the request and log the interaction when: log level is debug, a redirect, and a status code', function(done) {
            req.didRedirect = true;
            req.url = '/admin/hello';
            req.controllerResult = { redirect: '/somewhere/else', code: HttpStatusCodes.MOVED_TEMPORARILY };
            sandbox.stub(this.pb.log, 'isDebug').returns(true);
            sandbox.stub(this.pb.log, 'debug')
                .withArgs(sinon.match.string, sinon.match.number, req.url, ' REDIRECT=/somewhere/else', ' CODE='+HttpStatusCodes.MOVED_TEMPORARILY);

            var self = this;
            this.pb.Middleware.responseTime(req, res, function(err) {
                should(err).eql(undefined);
                self.pb.log.isDebug.calledOnce.should.eql(true);
                self.pb.log.debug.calledOnce.should.eql(true);
                done();
            });
        });
    });
github pencilblue / pencilblue / test / include / http / middleware / index.spec.js View on Github external
it('should set the end time on the request and log the interaction when: log level is debug, a redirect, and a status code', function(done) {
            req.didRedirect = true;
            req.url = '/admin/hello';
            req.controllerResult = { redirect: '/somewhere/else', code: HttpStatusCodes.MOVED_TEMPORARILY };
            sandbox.stub(this.pb.log, 'isDebug').returns(true);
            sandbox.stub(this.pb.log, 'debug')
                .withArgs(sinon.match.string, sinon.match.number, req.url, ' REDIRECT=/somewhere/else', ' CODE='+HttpStatusCodes.MOVED_TEMPORARILY);

            var self = this;
            this.pb.Middleware.responseTime(req, res, function(err) {
                should(err).eql(undefined);
                self.pb.log.isDebug.calledOnce.should.eql(true);
                self.pb.log.debug.calledOnce.should.eql(true);
                done();
            });
        });
    });
github Borewit / musicbrainz-api / src / musicbrainz-api.ts View on Github external
assert.ok(await this.login(), `should be logged in to ${this.config.botAccount.username} with username ${this.config.baseUrl}`);

    await this.rateLimiter.limit();

    let response: request.Response;
    try {
      response = await this.request.post({
        uri: `/${entity}/${mbid}/edit`,
        form: formData,
        followRedirect: false
      });
    } catch (err) {
      assert.ok(err.response.complete);
      response = err.response;
    }
    assert.strictEqual(response.statusCode, HttpStatus.MOVED_TEMPORARILY);
  }
github pencilblue / pencilblue / include / http / request_handler.js View on Github external
RequestHandler.prototype.doRedirect = function(location, statusCode) {
        this.resp.statusCode = statusCode || HttpStatusCodes.MOVED_TEMPORARILY;
        this.resp.setHeader("Location", location);
        this.resp.end();
    };
github Prior99 / hyrest / packages / hyrest / src / answers.ts View on Github external
export function movedTemporarily(arg1: T | string | Wrapper, arg2?: string): T {
    return answer(HTTP.MOVED_TEMPORARILY, arg1, arg2);
}