You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
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...
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.
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;
}
private void BeforeRequest(HttpRequestMessage httpRequestMessage)
{
// add headers.
}
The text was updated successfully, but these errors were encountered: