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
However this results in the below error: content type text/html does not have a factory registered to be parsed
On debugging further it was found that the APi call results in a a Bad Request 400 erro and the same is getting set in response body resulting in above error.
Looks like Content-tye is set to 2 values image/jpeg and application/octet-stream . Not sure if this is causeing the request to the MS graph API to fail
Hi ritu-rubrik , Thanks for trying the Graph Go SDK. Could you retry the code without setting the content header
i.e remove the line explicitly setting content header headers.Add("Content-Type", "image/jpg")
However I ended up getting the below error which resulted in me adding the Content-Type: Content-Type was application/octet-stream. Image Content-Type header should be one of the following: [image/bmp, image/emf, image/wmf, image/jpg, image/jpeg, image/gif, image/ico, image/png, image/exif, image/tif, image/tiff, image/*, images/*].
Also one another question I have is if the response is Bad Request , why is it not getting set in OData Error as it is a 4XX status code, instead it is getting set in the response body which is leading to the initial error.content type text/html does not have a factory registered to be parsed
I will be working on a solution on allowing users to override Content-Type which would be useful to in this case. As you correctly pointed out, whatever Content-Type header have right now, the sdk will override and set it to octet-stream. We will not be able to set the content type on the sdk at this moment as this SDK is "generated".
Also I've noted the issue with the issue with error management. Issue seems to be the underlying service accepts a payload with content type 'application/json' but reports the error as 'text/html'. We will be working on that as well
Ronald K (@rkodev) Can you open a corresponding issue in the metadata repo please?
Fundamentally, the API description should not describe a media type for the request body if the service does not support it.
Addressing the issue in the metadata emission phase would fix the issue for all generated clients, not just go.
Activity
rkodev commentedon Jul 15, 2024
Hi ritu-rubrik , Thanks for trying the Graph Go SDK. Could you retry the code without setting the content header
i.e remove the line explicitly setting content header
headers.Add("Content-Type", "image/jpg")headers := abstractions.NewRequestHeaders() - headers.Add("Content-Type", "image/jpg") configuration := &applications. ItemLogoRequestBuilderPutRequestConfiguration{ Headers: headers, }ritu-rubrik commentedon Jul 15, 2024
Hi Ronald K (@rkodev) I had initially tried it without setting the Content-Type
However I ended up getting the below error which resulted in me adding the Content-Type:
Content-Type was application/octet-stream. Image Content-Type header should be one of the following: [image/bmp, image/emf, image/wmf, image/jpg, image/jpeg, image/gif, image/ico, image/png, image/exif, image/tif, image/tiff, image/*, images/*].ritu-rubrik commentedon Jul 15, 2024
Also one another question I have is if the response is Bad Request , why is it not getting set in OData Error as it is a 4XX status code, instead it is getting set in the response body which is leading to the initial error.
content type text/html does not have a factory registered to be parsedrkodev commentedon Jul 15, 2024
Thanks for pointing this out,
I will be working on a solution on allowing users to override
Content-Typewhich would be useful to in this case. As you correctly pointed out, whateverContent-Typeheader have right now, the sdk will override and set it tooctet-stream. We will not be able to set the content type on the sdk at this moment as this SDK is "generated".Also I've noted the issue with the issue with error management. Issue seems to be the underlying service accepts a payload with content type 'application/json' but reports the error as 'text/html'. We will be working on that as well
[-]Upload app logo resulet in Error[/-][+]Upload app logo resulted in Error[/+]ritu-rubrik commentedon Jul 16, 2024
Ronald K (@rkodev) Thanks for acknowledging the issue. Is there a timeline for this that I can expect for this change to be available?
rkodev commentedon Jul 17, 2024
ritu-rubrik The fix should be ready within the next 7 days
baywet commentedon Jul 17, 2024
Ronald K (@rkodev) Can you open a corresponding issue in the metadata repo please?
Fundamentally, the API description should not describe a media type for the request body if the service does not support it.
Addressing the issue in the metadata emission phase would fix the issue for all generated clients, not just go.