Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

v3.5.0

Choose a tag to compare

@blittle blittle released this 10 Feb 21:49
· 102 commits to master since this release

Modify the startMockingRequests functionality to work with middleware.

import rxws from 'rxws';

// This will make RXWS not validate having a backend with a url to connect the websocket to
rxws.startMockingRequests();

rxws.requestUse()
  .subscribe(({req, send, reply, next}) => {    
    // Calling reply will immediately resolve the rx subscription without hitting the server
    reply({
      header: { ...req.header, statusCode: 200 },
      body: { data: 'whatever you want' }
    });
  });

// Re-enable validations
rxws.stopMockingRequests();

// Reset all internal `rxws` state (including middleware)
rxws.reset();