Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It's impossible to add .Header() to certain types of requests #60

Open
nfidirko opened this issue Sep 21, 2023 · 0 comments
Open

It's impossible to add .Header() to certain types of requests #60

nfidirko opened this issue Sep 21, 2023 · 0 comments

Comments

@nfidirko
Copy link

Description

For certain types of requests (e.g. deleting a payment source), when you're trying to add a header via .Header() an exception is thrown.

Affected versions

  • 3.8.0
  • 3.9.0

(Haven't tests earlier version)

Code to reproduce the error

var request = ChargeBee.Models.PaymentSource.Delete("test");
request.Header("test", "test");

Exception

Unhandled exception. System.InvalidCastException: Object must implement IConvertible.
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at ChargeBee.Api.EntityRequest`1.Header(String headerName, String headerValue)
   at Program.<Main>$(String[] args) in ......

Notes

It looks like this error occurs in all requests that have type EntityRequest<Type>.
The error is thrown here: (T) Convert.ChangeType((object) this, typeof (T));.
It also means that for such requests it's not possible to set idempotency key or add a parameter to such request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant