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

Error code 86. This method requires a PUT. #168

Open
IamR3m opened this issue Aug 26, 2021 · 3 comments
Open

Error code 86. This method requires a PUT. #168

IamR3m opened this issue Aug 26, 2021 · 3 comments

Comments

@IamR3m
Copy link

IamR3m commented Aug 26, 2021

Describe the bug
I try to update welcome message and got this error message

To Reproduce
Steps to reproduce the behavior:

  1. Send next request
    twurl -A 'Content-type: application/json' -X PUT '/1.1/direct_messages/welcome_messages/update.json?id=${WELCOME_MESSAGE_ID}' -d '{"message_data": {"text": "${NEW_WELCOME_MESSAGE}"}}'
  2. See error
    {"errors":[{"code":86,"message":"This method requires a PUT."}]}

Expected behavior
Welcome message updated

Desktop (please complete the following information):

  • OS: Windows 10
  • Version 0.9.6
@IamR3m
Copy link
Author

IamR3m commented Aug 26, 2021

Same error when I try to delete Welcome Message.

When I run command with -t option I found that request sent with POST method instead

opening connection to api.twitter.com:443...
opened
starting SSL for api.twitter.com:443...
SSL established, protocol: TLSv1.2, cipher: ECDHE-RSA-AES128-GCM-SHA256
<- "POST /1.1/direct_messages/welcome_messages/update.json?id=${WELCOME_MESSAGE_ID} HTTP/1.1\r\nContent-Type: application/json\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: twurl version: 0.9.6 platform: ruby 3.0.2 (x64-mingw32)\r\nAuthorization: OAuth oauth_body_hash=\"${oauth_body_hash}\", oauth_consumer_key=\"${oauth_consumer_key}\", oauth_nonce=\"${oauth_nonce}\", oauth_signature=\"${oauth_signature}\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1629982183\", oauth_token=\"${oauth_token}\", oauth_version=\"1.0\"\r\nConnection: close\r\nHost: api.twitter.com\r\nContent-Length: 42\r\n\r\n"
<- "{\"message_data\": {\"text\": \"${NEW_WELCOME_MESSAGE}\"}}"
-> "HTTP/1.1 400 Bad Request\r\n"
-> "date: Thu, 26 Aug 2021 12:49:41 GMT\r\n"
-> "allow: PUT\r\n"
-> "server: tsa_o\r\n"
-> "status: 400 Bad Request\r\n"
-> "set-cookie: personalization_id=\"${personalization_id}\"; Max-Age=63072000; Expires=Sat, 26 Aug 2023 12:49:41 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None\r\n"
-> "set-cookie: guest_id=${guest_id}; Max-Age=63072000; Expires=Sat, 26 Aug 2023 12:49:41 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None\r\n"
-> "content-type: application/json;charset=utf-8\r\n"
-> "cache-control: no-cache\r\n"
-> "x-transaction: ${x-transaction}\r\n"
-> "content-length: 89\r\n"
-> "x-access-level: read-write-directmessages\r\n"
-> "x-frame-options: SAMEORIGIN\r\n"
-> "content-encoding: gzip\r\n"
-> "x-xss-protection: 0\r\n"
-> "content-disposition: attachment; filename=json.json\r\n"
-> "x-content-type-options: nosniff\r\n"
-> "strict-transport-security: max-age=631138519\r\n"
-> "x-connection-hash: ${x-connection-hash}\r\n"
-> "connection: close\r\n"
-> "\r\n"
reading 89 bytes...
-> "\x1F\x8B\b\x00\x00\x00\x00\x00\x00\xFF\xAAVJ-*\xCA/*V\xB2\x8A\xAEVJ\xCEOIU\xB2\xB20\xD3Q\xCAM-.NL\ar\x94B22\x8B\x15rSK2\xF2S\x14\x8AR\vK3\x8BR\x8B\x15\x12\x15\x02BC\xF4\x94jck\x01\x00\x00\x00\xFF\xFF\x03\x007d\xCD\x0E@\x00\x00\x00"
{"errors":[{"code":86,"message":"This method requires a PUT."}]}read 89 bytes
Conn close

@andypiper
Copy link
Contributor

This is the Ruby 3 compatibility issue (#159, #160). This will work with Ruby 2.7, for example.

@mabelbot
Copy link

Strangely I'm suddenly encountering the same issue but with DELETE (deleting welcome message) however, it was working just fine a little over a month ago. To my knowledge I've been using the same version of Ruby, Ruby 3, all along. I downgraded to Ruby 2.7 and it worked as promised.

@andypiper andypiper removed their assignment Dec 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants