-
Notifications
You must be signed in to change notification settings - Fork 496
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
Pass WebAPI args as generic objects. Encode with correct HttpUtility.UrlEncode override #668
Conversation
…he correct override of HttpUtility.UrlEncode at request time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks OK at first, let's just not forget to document it properly in the changelog, something along:
Breaking change for WebAPI endpoints that accept
rawbinary
, you should now providebyte[]
directly as an argument, as opposed to crafting encoded value yourself.
All other values will now be encoded in the request.
I'm just not sure if this change won't break stuff in regards to server-based interpretation. Previously, I had this code: await iSteamUserAuth.AuthenticateUser(
encrypted_loginkey: Encoding.ASCII.GetString(WebUtility.UrlEncodeToBytes(encryptedLoginKey, 0, encryptedLoginKey.Length)),
method: WebRequestMethods.Http.Post,
sessionkey: Encoding.ASCII.GetString(WebUtility.UrlEncodeToBytes(encryptedSessionKey, 0, encryptedSessionKey.Length)),
steamid: steamID
) After this change, I expect to use this: await iSteamUserAuth.AuthenticateUser(
encrypted_loginkey: encryptedLoginKey,
method: WebRequestMethods.Http.Post,
sessionkey: encryptedSessionKey,
steamid: steamID
) I guess I'll just test this change once it's ready, feel free to ping me if you'd like me to. |
Yes, the intention is to pull the encoding logic out of user code and into the library. You should be using the second example. I have not done extensive testing yet. |
Codecov Report
@@ Coverage Diff @@
## master #668 +/- ##
==========================================
- Coverage 23.68% 23.52% -0.16%
==========================================
Files 85 85
Lines 8720 8726 +6
Branches 718 719 +1
==========================================
- Hits 2065 2053 -12
- Misses 6525 6545 +20
+ Partials 130 128 -2
Continue to review full report at Codecov.
|
Something is wrong since it's no longer possible to make ISteamUserAuth/AuthenticateUser work in any form. Steam responds with 400 bad request when supplied with |
In any case, just ensure the above is solved before triggering any stable release, since right now it's not just a regression but regression with no means of correction (@yaakov-h). |
For what it's worth, the non dynamic method works for me: |
You gave me good enough reason to ditch dynamic calls and just use non-dynamic ones instead, dynamic ones feel far more problematic than what it's worth 🤔. I'll see if it fixes my issue (and if yes, we'll know where the issue is). Thanks @xPaw! |
I can confirm what @xPaw said above (thank you!), the issue doesn't exist when using |
Check fa128f1 The setup of the dictionary should be the same now. It was enumerating byte[] arrays. |
Thanks for the quick fix! ❤️ |
@JustArchi A new build is rolling out now, should be live on NuGet by the time you read this. |
Breaking change. Rather than forcing everything into a string up front, keep them as generic objects. See #641
These comments need clarification: