Skip to content

Incorrect Content-Type in put() call. Default Content-Type should be application/json #183

@vdnsv

Description

@vdnsv

Bug Report

Prerequisites

  • Can you reproduce the problem?
  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you perform a cursory search?

For more information, see the CONTRIBUTING guide.

Description

Method put() creates options object with Content-Type: application/octet-stream in headers instead of application/json:

public async put(content: any, callback?: GraphRequestCallback): Promise<any> {
	const url = this.buildFullUrl();
	const options: FetchOptions = {
		method: RequestMethod.PUT,
		body: serializeContent(content),
		headers: {
			"Content-Type": "application/octet-stream",
		},
	};
	try {
		const response = await this.send(url, options, callback);
		return response;
	} catch (error) {
		throw error;
	}
}

Console Errors:

GraphError {
statusCode: 400,
code: 'UnknownError',
message: 'Argument: sourceEntity, Value: is null.',
requestId: '7c662662-70f8-4226-96d7-190cbefd4590',
date: 2019-06-05T13:04:12.000Z,
body:
'{"code":"UnknownError","message":"Argument: sourceEntity, Value: is null.","innerError":{"request-id":"7c662662-70f8-4226-96d7-190cbefd4590","date":"2019-06-05T16:04:12"}}' }

Steps to Reproduce

await client.api(/teams/${teamId}/schedule/schedulingGroups/${schedulingGroupId})
.version('beta')
.put(schedulingGroup)

Expected behavior:
It should work.

Actual behavior:
Exception with Status Code 400 and strange message "Argument: sourceEntity, Value: is null."

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions