From dcebc78eb5e5c9f7fb3ae8175b8e8171b07df933 Mon Sep 17 00:00:00 2001 From: dudegladiator Date: Fri, 20 Feb 2026 19:28:33 +0530 Subject: [PATCH] fix: properly unpack _execute() tuple in drafts.create() and drafts.update() for multipart requests When creating or updating a draft with attachments >= 3MB (multipart/form-data), _http_client._execute() returns a (json_response, headers) tuple. The multipart code paths in create() and update() assigned the entire tuple to a single variable instead of unpacking it, causing TypeError. Applied the same tuple-unpacking pattern already used in send() to both create() and update() multipart code paths. Fixes #454 --- nylas/resources/drafts.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nylas/resources/drafts.py b/nylas/resources/drafts.py index e817d5f..14d07d4 100644 --- a/nylas/resources/drafts.py +++ b/nylas/resources/drafts.py @@ -114,14 +114,14 @@ def create( for attachment in request_body.get("attachments", []) ) if attachment_size >= MAXIMUM_JSON_ATTACHMENT_SIZE: - json_response = self._http_client._execute( + json_response, headers = self._http_client._execute( method="POST", path=path, data=_build_form_request(request_body), overrides=overrides, ) - return Response.from_dict(json_response, Draft) + return Response.from_dict(json_response, Draft, headers) # Encode the content of the attachments to base64 for attachment in request_body.get("attachments", []): @@ -162,14 +162,14 @@ def update( for attachment in request_body.get("attachments", []) ) if attachment_size >= MAXIMUM_JSON_ATTACHMENT_SIZE: - json_response = self._http_client._execute( + json_response, headers = self._http_client._execute( method="PUT", path=path, data=_build_form_request(request_body), overrides=overrides, ) - return Response.from_dict(json_response, Draft) + return Response.from_dict(json_response, Draft, headers) # Encode the content of the attachments to base64 for attachment in request_body.get("attachments", []):