httparty


HTTParty force_encoding: encode_with_ruby_encoding


I've recently updated from 0.14.0 to version 0.15.2 and when I try to execute a #delete I'm receiving the following stacktrace:
NoMethodError: undefined method `force_encoding' for nil:NilClass
from /Users/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/httparty-0.15.1/lib/httparty/request.rb:280:in `encode_with_ruby_encoding'
from /Users/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/httparty-0.15.1/lib/httparty/request.rb:316:in `_encode_body'
from /Users/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/httparty-0.15.1/lib/httparty/request.rb:322:in `encode_body'
from /Users/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/httparty-0.15.1/lib/httparty/request.rb:350:in `handle_response'
from /Users//.rben`enter code here`v/versions/2.4.0/lib/ruby/gems/2.4.0/gems/httparty-0.15.1/lib/httparty/request.rb:158:in `perform'
from /Users/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/httparty-0.15.1/lib/httparty.rb:563:in `perform_request'
from /Users/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/httparty-0.15.1/lib/httparty.rb:520:in `delete'
from /Users/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/httparty-0.15.1/lib/httparty.rb:617:in `delete'
I reverted back to version 0.14.0 and the issue doesn't persist. I'm a beginner to Ruby and I'm not really sure what this message is indicating.
Any assistance would be grateful.
If you look at https://github.com/jnunemaker/httparty/blob/e9f4624c1172120bbd39ddc636620a24fc9386b1/lib/httparty/request.rb#L278 you can see the force_encoding method referenced in the stack trace.
It appears that the response has no body, and so this method is being called on a nil object, which causes the error. This seems like a bug in HTTParty. If you can figure out reproduction steps to consistently produce this issue you could open up a github issue for the HTTParty folks to look into it further.

Related Links

HTTParty force_encoding: encode_with_ruby_encoding
Using plus signs in query strings with HTTParty
Can't convert String to integer or undefined method nil for []
HTTparty in Rhodes

Categories

HOME
embedded
phantom-dsl
twitter-bootstrap-3
c++11
case
static
mysql-workbench
apache-spark-mllib
socket.io
edge
mips
parameters
nested-if
google-admin-sdk
jtextpane
computer-science
sendgrid-api-v3
jquery-ui-sortable
minecraft-forge
vimdiff
github-enterprise
rtf
filechannel
code-generation
frequency-distribution
modbus-tcp
chargify
smartclient
mapstruct
gulp-watch
dataflow-diagram
gmock
jboss6.x
has-and-belongs-to-many
genexus-sd
handler
browser-sync
twiml
testbed
fossil
carriage-return
sharding
python-import
numpy-broadcasting
latitude-longitude
graphhopper
cd
timing
cin
opensmpp
resolution
azure-arm
odoo-website
levenshtein-distance
claims
placeholder
textsum
reportservice2010
geotiff
insight
pair-programming
opengl-4
er-diagram
seq
janus
d3-force-directed
meteor-packages
xcode-server
async.js
hclust
expectations
avspeechsynthesizer
kiosk
invoke-sqlcmd
tfs-workitem
iokit
vigenere
oracle-spatial
django-urls
lasso
eoferror
ocra
botan
node-serialport
adehabitathr
grouping-sets
packet-sniffers
pseudo-class
iso-prolog
trdion2011
live555
wxformbuilder
dct
conditionaltagsupport
openargs
visual-studio-express
scrypt
windows-phone-8-sdk
tlf
epiceditor
android-icons
http-status-code-410
frameworkelementfactory
patricia-trie
jquery-blockui
xcode3.2
correlated-subquery
garbage
boost-signals
denied
user-tracking
update-statement
creole
vs-android
pos-for-.net
dsl-tools
lobo-cobra
asynchronous-wcf-call
perl5.12

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App