Giter VIP home page Giter VIP logo

proxickls's Introduction

proxickls

WIP

A lightweight HTTP(S) mock proxy aimed at mocking responses of REST APIs for front-end testing purposes.

Starting proxickls

node bin/index --target=http://targethost.com --port=5001 (optional)

Where port is the port the proxy server will listen on and target is the server to which calls that are not mocked will be proxied.

Setting a mock response

/proxy/setMockResponse

Method: PUT

Content body

 {
     "url": "/the/url/to/override",
     "statusCode": 500,
     "body": {
         "sample": "response"
     },
     "responseHeaders": {
         "Authorization": "Bearer ABCDEFABCDEFABCDEFABCDEFABCDEF",
         "X-Proxickls": "Some Mock Response Header"
     },
     delay : 2000
 }

Setting a delay is optional!

Setting multiple delays

Set multiple delays at once. This will also affect existing mock responses!

/proxy/setMockResponse

Method: POST

Content body

 {
     "delays": [
         {
            "url": "/url",
            "delay": 2000
         },
         {
            "url": "/anotherurl",
            "delay": 5000
         }
      ]
 }

Clear a specific mock response

/proxy/clearMockResponse

Method: DELETE

Content body

 {
     "url": "/the/mock/url/to/remove"
 }

Clear all mock responses

/proxy/clearAllMockResponses

Method: DELETE

Clear all delays

Clear all delays. Does NOT clear any mock responses however!

/proxy/clearAllDelays

Method: DELETE

List proxied requests

Generate a list of all the requests that have been proxied through the proxy server and their responses (if any)

/proxy/listProxiedRequests?limit=50

Method: GET

Parameters:

limit The maximum number of requests (defaults to unlimited)

Clear the list of proxied calls

Method: DELETE

/proxy/clearProxiedCalls

proxickls's People

Contributors

tickls avatar tombrtls avatar

Watchers

 avatar  avatar  avatar

proxickls's Issues

feature request: Implement delay

I'dd like to be able to set a delay in the responses as a way to be able to control the order in which responses are returned. (e.g. for asynchronous testing)

The way I see it there could be a separate endpoint e.g. a POST to /proxy/setDelay and post the delay in ms. The response of the listed calls would be delayed wether or not the response is manipulate.

An array of requests would be perfect if possible :-)

{
  "delay": [
    {
      "url": "/oauth/token",
      "delay": 2500
    },
    {
      "url": "/mobile/dashboard/84151105208",
      "delay": 0
    }
  ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.