defake in sinon not working correctly #1174

hosing-lee opened this Issue Oct 24, 2016 · 2 comments


None yet

3 participants

  • Sinon version : 1.17.1
  • Environment : OSX El Capitan 10.11.16, Chrome 53.0.2758
  • Example URL : NA
  • Other libraries you are using: Polymer 1.7.0, iron-ajax 1.4.3

In our code we are using sinon.fakeServer with filters turned on. The filtering works with the provided filter pattern, but the response of the filtered endpoints are returned as String instead of Objects. When we disable sinon all the endpoints are returning Objects as expected.

By inspecting the source code I see that sinon simply copies the response instead of parsing the json response to an object.


Does it still fail with latest release version of Sinon.JS, v.1.17.6?

Could you provide code samples that shows how this fails?

dmitriyilin commented Dec 8, 2016 edited

I experience the same issue.

As sample code you can take iron-ajax element
Add following snippet to the demo/index.html

    <script src="../../sinonjs/sinon.js"></script>
        this.server = sinon.fakeServer.create();
        this.server.autoRespond = true;

        this.server.xhr.useFilters = true;
        this.server.xhr.addFilter(function(method, url, async, username, password) {
            return true;

And run demo of the element.

I use Sinon.JS, v.1.17.6 (built from sources), Polymer 1.17.0, iron-ajax 1.4.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment