[Bug] Unable to send a POST request using the low level CallApiForUserAsync
abrousseau-hcgov opened this issue · 3 comments
Which version of Microsoft Identity Abstractions for dotnet are you using?
Note that to get help, you need to run the latest version.
Microsoft Identity Abstractions 7.0.2
Is this a new or an existing app?
This is a new app using IDownstreamApi from a client to communicate with a downstream api
var downstreamApiOptions = new Action<DownstreamApiOptions>(
options =>
{
options.HttpMethod = HttpMethod.Post;
options.BaseUrl = baseUrl;
options.RelativePath = relativePath;
});
// This is a Stream passed to the client
var inputContent = new StreamContent(fileToUpload);
inputContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
DispositionType = "form-data",
FileName = fileName,
Size = fileToUpload.Length
};
inputContent.Headers.ContentType =
MediaTypeHeaderValue.Parse(SharePointFileManagementConstants.MimeResponseApplicationOctetStream);
inputContent.Headers.ContentLength = fileToUpload.Length;
var multipartFormDataContent = new MultipartFormDataContent {{inputContent, fileName, fileName}};
var responseMessage = await _downstreamApi.CallApiForUserAsync(SiteServiceName,
downstreamApiOptions,
null,
multipartFormDataContent
);
Expected behavior
There should be a call to the downstream api using the POST HTTP method
Actual behavior
An exception is thrown when the client tries to send the request downstream:
Method not found: 'Void Microsoft.Identity.Abstractions.AuthorizationHeaderProviderOptions.set_HttpMethod(System.Net.Http.HttpMethod)'.
On the 20th of September this commit happened
and the public API for DownstreamApiOptions was updated (thru its base class) AuthorizationHeaderProviderOptions
A private project of mine also broke ... if this is trully required I think it should have been packaged as part of a Major (breakin) release. For me things broke going from 2.13.4 to 2.15.1
@edsonschmitt Thank you for that. It seems like it was a breaking change where I had a newer version of DownstreamApi and the older Web/Web.Ui 2.13.4 version. I think that change in DownstreamApi should be made a major breaking change as you suggested. I will leave this bug for hopefully an official response.
No repro.
But I agree, Identity.Web should have taken a major version change.