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

oDataFeed.BeforeRequest not triggered #9

Open
parcae opened this issue Sep 12, 2014 · 4 comments
Open

oDataFeed.BeforeRequest not triggered #9

parcae opened this issue Sep 12, 2014 · 4 comments

Comments

@parcae
Copy link

parcae commented Sep 12, 2014

I'm using the Simple.OData module to try to connect to an OData service. The service needs authentication to connect.
I have registered the BeforeRequest event to set the neccesary headers before doing any request.

However, my BeforeRequest is not triggerd at all.
See my code below, am I missing something?

public void GetData()
{
var oDataFeed = new ODataFeed(ApiBaseUrl);
oDataFeed.BeforeRequest += BeforeRequest;
oDataFeed.AfterResponse += AfterResponse;

        Context = Database.Opener.Open(ApiBaseUrl);
        // do some more

}

private void BeforeRequest(HttpRequestMessage httpRequestMessage)
{
// add headers.
}

@object
Copy link
Member

object commented Sep 12, 2014

Hello Martijn,

Thank you for the report. I will test it and come back to you shortly.

Vagif

@parcae
Copy link
Author

parcae commented Sep 12, 2014

Hi, thanks for the respone, I seem to have it fixed. It was a mistake in my code. I did register the events in the Constructor of my Class, which did not work. Registering them just before the actual call is made has solved my issue.

@parcae
Copy link
Author

parcae commented Sep 12, 2014

Hm, now it seems to be broke again, it did fire and triggered the BeforeRequest once, but after rebuilding and a minor config change (added an AppSetting), the event is not triggered again...

@object
Copy link
Member

object commented Sep 12, 2014

I will test both cases (in the constructor and before the call) and see what's going on. I have some unit tests that work but I will experiment with different scenarios.

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

2 participants