Closed woodwo closed 2 years ago
I can workaround it by adding
app.use(express.text({type: () => {return true}}));
after https://github.com/testinggospels/camouflage/blob/develop/src/index.ts#L46
But it surely not the best option as it should be (as I am not the JS developer nor have the express insights =).
That seems like a valid solution. By using express.text() you are parsing the request body into a plain string. If you want to continue using this solution, you may want to inject it as an external middleware.
middleware.js
at the root of your camouflage project.npm i -g express
export NODE_PATH=`npm root -g`
If you are on windows
npm root -g
set NODE_PATH="output of previous command"
middleware.js
file as follows:
var require = global.require || global.process.mainModule.constructor._load;
(() => {
const express = require('express')
this.app.use(express.text({ type: () => { return true } }));
this.app.use("/", this.allRoutes);
})();
For more details on middleware injection, refer to the documentation.
Now it seems clear from docs that it can be used in my case too. Issue should be closed now! Thank you for your help.
Describe the bug I am mocking SOAP 1.1 server. My code under test set header to
Content-Type: text/xml;charset=UTF-8
(as in spec). With such header my mock body parsing is not working, response.body is empty in logs.To Reproduce Steps to reproduce the behavior:
{ "cid": "{{capture from='body' using='regex' selector='(\d+)<\/customerId>'}}"
}
<?xml version="1.0"?>