restbase
restbase copied to clipboard
Replace preq with api-testing REST client
Bug: T265846
I have been able to replace preq with the api-testing REST client within 11 out of 13 tests.
The two tests that are failing when I switch them to client.post are;
-
The
html2wt with scrub_wikitexttest fails with error 400 whenever thescrub_wikitext: 1parameter is added. -
The
supports stashing contenttest fails at the secondclient.post.
Could there be something I am missing that is causing these two tests to fail?
Could there be something I am missing that is causing these two tests to fail?
Can you add the changes you made for these tests into the PR too? It's hard to debug not knowing what you've done.
The html2wt with scrub_wikitext test fails with error 400 whenever the scrub_wikitext: 1 parameter is added.
I've tried to change this one locally and it works for me.
The supports stashing content test fails at the second client.post.
So, this one requires you to set a if-match header and I haven't found a way to do it in api-testing. @clarakosi writes in the api-testing library under request jsdoc:
The request has not been sent when this method returns, and can still be modified like a superagent request.
So I've attempted to just use .set there, but to no success - since the 'api-testing.request' method is async, it returns a promise, and that JSDoc is incorrect. Thus, the api-testing library needs fixing - we need a way to set arbitrary headers to requests, at least in REST. You can work with @clarakosi on that.
Can you add the changes you made for these tests into the PR too? It's hard to debug not knowing what you've done.
The two tests that are failing have been added into the PR.
Hope we can find a way to make them work with the api-testing REST client.
@clarakosi and @Pchelolo, all instances of preq have been replaced with the api-testing REST client in transform.js and all 13 tests are passing. Thanks to both of you!