Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Netflix Announces Polly.JS HTTP Interaction Library

Netflix Announces Polly.JS HTTP Interaction Library

This item in japanese

Netflix recently announced the release of Polly.JS, an open source library for recording, replaying and stubbing HTTP interactions.

Polly leverages native browser APIs to mock requests and responses with minimal configuration, providing developers with a mechanism to manage HTTP requests.

The Netflix team found that keeping fixtures and factories in parity with APIs is challenging, which led to the creation of Polly. Polly records and maintains server responses in a flexible manner. For example, it is possible to record and replay HTTP interactions during test runs to verify application accuracy, as well as capturing requests and responses to simulate changes to application state.

Polly supports both Fetch and XHR requests and provides test helpers for Mocha and QUnit test helpers. Developers may intercept, modify, and attach events, as well as apply changes to accelerate or decelerate request response times.

Recording of HTTP interactions with Polly may be saved to disk or local storage within a browser in HTTP Archive (HAR) format.

Browser support is currently for Evergreen browsers (most recent releases of major browsers). Support for Internet Explorer 11 is under active development based on community feedback.

The Polly team is also working to make the library work in an isomorphic manner to support other testing frameworks, such as Jest and Intern. Testing is currently limited to work within web browsers.

Polly.JS is available under the Apache 2 license. Contributions are encouraged via GitHub. Prospective contributors are encouraged to read the contributing guidelines.

Rate this Article