# Closing brace missing in webhook JSON

**URL:** <https://meta.discourse.org/t/closing-brace-missing-in-webhook-json/50418>\
**Category:** Bug\
**Created:** [20 سبتمبر 2016، 11:31م UTC](https://meta.discourse.org/t/closing-brace-missing-in-webhook-json/50418 "2016-09-20T23:31:45Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)\
**Post date:** [21 سبتمبر 2016، 2:54ص UTC](https://meta.discourse.org/t/closing-brace-missing-in-webhook-json/50418/5 "2016-09-21T02:54:25Z")

</div>

Yes, it does if the field is not provided. In `connection.rb`:

```ruby
body = datum[:body].is_a?(String) ? StringIO.new(datum[:body]) : datum[:body]

# The HTTP spec isn't clear on it, but specifically, GET requests don't usually send bodies;
# if they don't, sending Content-Length:0 can cause issues.
unless datum[:method].to_s.casecmp('GET') == 0 && body.nil?
  unless datum[:headers].has_key?('Content-Length')
    datum[:headers]['Content-Length'] = detect_content_length(body)
  end
end

```

```ruby
def detect_content_length(body)
  if body.respond_to?(:size)
    # IO object: File, Tempfile, StringIO, etc.
    body.size
  elsif body.respond_to?(:stat)
    # for 1.8.7 where file does not have size
    body.stat.size
  else
    0
  end
end

```

Since we need to record that field in the log, it doesn’t matter.

But it’s worthwhile to build a module for the job and redeliver action. 1) Reuse the code. 2) Easier to replace `Excon`.

---

_[View the full topic](https://meta.discourse.org/t/closing-brace-missing-in-webhook-json/50418)._
