Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/graph/content-types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class _ContentTypes extends _GraphCollection<IContentTypeEntity[]>{
public async addCopyFromContentTypeHub(contentTypeId: string): Promise<IContentTypeAddResult> {
const creator = ContentType(this, "addCopyFromContentTypeHub").using(JSONHeaderParse());
const result = await graphPost(creator, body({ contentTypeId }));
const pendingLocation = result?.headers?.location || null;
const pendingLocation = result?.headers?.get("location") || null;
return {
data: result.data,
contentType: (<any>this).getById(result.data.id),
Expand Down
4 changes: 2 additions & 2 deletions packages/queryable/behaviors/parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ export function JSONHeaderParse(): TimelinePipe {
return parseBinderWithErrorCheck(async (response) => {

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
if ((response.headers.has("Content-Length") && parseFloat(response.headers.get("Content-Length")!) === 0) || response.status === 204) {
if (response.status === 204) {
return {};
}

// patch to handle cases of 200 response with no or whitespace only bodies (#487 & #545)
const txt = await response.text();
const json = txt.replace(/\s/ig, "").length > 0 ? JSON.parse(txt) : {};
return { data: { ...parseODataJSON(json) }, headers: { ...response.headers } };
return { data: { ...parseODataJSON(json) }, headers: response.headers };
});
}

Expand Down