Commit f9d2cad3 authored by Jason Benterou's avatar Jason Benterou
Browse files

Support PATCH

parent 718a1a8c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ function rp(options) {
        'HEAD' : [200],
        'PUT' : [200, 201],
        'POST' : [200, 201],
        'PATCH' : [200, 201],
        'DELETE' : [200, 201]
    }, c = {simple: true}, i;
    if (typeof options === 'string') {
+31 −3
Original line number Diff line number Diff line
@@ -66,7 +66,35 @@ describe('request tests', function () {
                }).catch(function(){
                    done(new Error('A 500 response code should resolve, not reject'));
                });
        })
    })
        });
    });

    describe('HTTP methods', function(){
        it('should support PATCH', function(done){
            var options = {
                url: 'http://localhost:4000/200',
                method: 'PATCH'
            };
            rp(options)
                .then(function(){
                    done();
                }).catch(function(){
                    done(new Error('A 200 response code for a PATCH request should resolve, not reject'));
                });
        });

        it('should support DELETE', function(done){
            var options = {
                url: 'http://localhost:4000/200',
                method: 'DELETE'
            };
            rp(options)
                .then(function(){
                    done();
                }).catch(function(){
                    done(new Error('A 200 response code for a DELETE request should resolve, not reject'));
                });
        });
    });

});