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
The content-type header causes Faraday library to skip the JSON encoding which results in the error. Although this header is supposedly necessary according to the RFC in fact it is not required by the 1Password API.
In addition, though, the API expects the changes (in the body) to be a list. However as attributes comes from the remaining named parameters this is not possible
Describe the bug
The update_item() call fails, as the supplied data format is wrong
To Reproduce
Try updating an item via the SDK, such as using
This fails with "undefined method `bytesize'"
Expected behavior
The call should return cleanly with an updated object
Environment
Additional context
The problem is here in client/items.rb -
The content-type header causes Faraday library to skip the JSON encoding which results in the error. Although this header is supposedly necessary according to the RFC in fact it is not required by the 1Password API.
In addition, though, the API expects the changes (in the body) to be a list. However as attributes comes from the remaining named parameters this is not possible
A solution is to instead use:
This converts the attributes into the required array, and returns to the default content-type (JSON) which is properly encoded by the Faraday library.
Tested Faraday library versions
faraday (1.10.0)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
The text was updated successfully, but these errors were encountered: