Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

easymock server crashes on cancelled requests #69

Open
sascha-haenlein opened this issue Feb 21, 2018 · 0 comments
Open

easymock server crashes on cancelled requests #69

sascha-haenlein opened this issue Feb 21, 2018 · 0 comments

Comments

@sascha-haenlein
Copy link

sascha-haenlein commented Feb 21, 2018

I was working on cancelling an open request and recognized that my easymock server always crashes with the following message when request gets cancelled:

_http_outgoing.js:492
    throw new Error('"value" required in setHeader("' + name + '", value)');
    ^

Error: "value" required in setHeader("x-forwarded-for", value)
    at validateHeader (_http_outgoing.js:492:11)
    at ClientRequest.setHeader (_http_outgoing.js:501:3)
    at new ClientRequest (_http_client.js:173:14)
    at Object.request (http.js:38:10)
    at exports.HttpProxy.HttpProxy.proxyRequest (E:\Projects\amino-dat-online\node_modules\easymock\node_modules\http-proxy\lib\node-http-proxy\http-proxy.js:247:39)
    at exports.RoutingProxy.RoutingProxy.proxyRequest (E:\Projects\amino-dat-online\node_modules\easymock\node_modules\http-proxy\lib\node-http-proxy\routing-proxy.js:239:9)
    at Timeout._onTimeout (E:\Projects\amino-dat-online\node_modules\easymock\lib\easymock.js:214:15)
    at ontimeout (timers.js:475:11)
    at tryOnTimeout (timers.js:310:5)
    at Timer.listOnTimeout (timers.js:270:5)

That is how it can be caused:

mockserver config.json:

{
	"cors": true,
	"jsonp": false,
	"simulated-lag": 5000,
	"variables": {
	},
	"routes": [
	]
}

within any component:

let subject = new Subject<true>();

this.http.get('http://localhost:3000/mocks/data', {responseType: 'json'})
	.takeUntil(subject)
	.subscribe(
		(data) =>{
			this.responseData = data;
		},
		(err) =>{
		});

setTimeout(()=>{
	subject.next(true);
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant