On Fri, 25 Apr 2014 17:14:00 GMT, Sönke Ludwig wrote:

On Fri, 25 Apr 2014 16:17:57 GMT, Darius Clark wrote:

Hi,

I am currently getting an error when using requestHTTP

function vibe.http.client.requestHTTP (string url, scope void delegate(scope HTTPClientRequest req) requester = null) is not callable using argument types (string, void, void)

It points to the line where the url is at in the requestHTTP function

...

Any clue to why this is happening? If I am to remove the line where the callback varable is located it compiles without errors.

Sometimes the error messages are a bit misleading when multiple overloads and anonymous delegates are involved. It could be that there is actually a compile error in the callback = line. One way to test that would be to use a nested function instead and see if the error message changes:

void resHandler(scope HTTPClientResponse res) {
	if(res.statusCode is 200){
		ExampleTemplate callback =  deserializeJson!ExampleTemplate(parseJsonString(res.bodyReader.readAllUTF8()));
	}
}

requestHTTP(callurl,
	(scope req) {
	},
	&resHandler
);

BTW, parseJsonString(res.bodyReader.readAllUTF8()) can also be replaced by res.readJson().

Thank you for your answer. Oddly, that did fix that issue but any reason why it would cause that error? I had to kind of recode the way the function work to return the proper information. Also thank you for the tip on on res.readJson(). That made it simple enough. I was looking for something like that but couldnt find it (might not look hard enough).