Summary:
When upload_container() is called and _call_filemaker() raises an exception before the second _set_content_type() executes, the "Content-Type" header is not restored. This leaves the session headers in a broken state, causing later API calls to fail with either a KeyError or FileMaker error 1708.
Steps to Reproduce:
- Call
upload_container() with an expired or invalid Data API token.
_call_filemaker() raises a FileMakerError (FMSErrorCode.InvalidDAPI_TOKEN).
- The wrapper calls
login() to refresh the token.
- The
"Content-Type" header is missing because it was popped before _call_filemaker() raised the error.
- Subsequent
_call_filemaker() calls fail with error 1708:
fmrest.exceptions.FileMakerError: FileMaker Server returned error 1708, Invalid content type (application/octet-stream). These are valid: application/json
Additionally, the _set_content_type(None) step in upload_container() will now throw a KeyError on self._headers.pop('Content-Type') since the header is missing.
Summary:
When
upload_container()is called and_call_filemaker()raises an exception before the second_set_content_type()executes, the"Content-Type"header is not restored. This leaves the session headers in a broken state, causing later API calls to fail with either aKeyErroror FileMaker error 1708.Steps to Reproduce:
upload_container()with an expired or invalid Data API token._call_filemaker()raises aFileMakerError(FMSErrorCode.InvalidDAPI_TOKEN).login()to refresh the token."Content-Type"header is missing because it was popped before_call_filemaker()raised the error._call_filemaker()calls fail with error 1708:Additionally, the
_set_content_type(None)step inupload_container()will now throw aKeyErroronself._headers.pop('Content-Type')since the header is missing.