<commit_before>'use strict'

var util = require('util')

module.exports = function (source, options) {
  var self = this
  var code = []
  code.push('require \'uri\'')
  code.push('require \'net/http\'')
  code.push(null)

  // To support custom methods we check for the supported methods
  // and if doesn't exist then we build a custom class for it
  var method = source.method.toUpperCase()
  var methods = ['GET', 'POST', 'HEAD', 'DELETE', 'PATCH', 'PUT', 'OPTIONS', 'COPY', 'LOCK', 'UNLOCK', 'MOVE', 'TRACE']
  var capMethod = method.charAt(0) + method.substring(1).toLowerCase()
  if (methods.indexOf(this.source.method.toLowerCase()) === 0) {
    code.push('class Net::HTTP::%s < Net::HTTPRequest')
    code.push(util.format('class Net::HTTP::%s < Net::HTTPRequest', capMethod))
    code.push(util.format('  METHOD = \'%s\'', method.toUpperCase()))
    code.push(util.format('  REQUEST_HAS_BODY = \'%s\'', self.source.postData.text ? 'true' : 'false'))
    code.push('  RESPONSE_HAS_BODY = true')
    code.push('end')
    code.push(null)
  }
<commit_msg>Minor refactor<commit_after>'use strict'

var util = require('util')

module.exports = function (source, options) {
  var self = this
  var code = []
  code.push('require \'uri\'')
  code.push('require \'net/http\'')
  code.push(null)

  // To support custom methods we check for the supported methods
  // and if doesn't exist then we build a custom class for it
  var method = source.method.toUpperCase()
  var methods = ['GET', 'POST', 'HEAD', 'DELETE', 'PATCH', 'PUT', 'OPTIONS', 'COPY', 'LOCK', 'UNLOCK', 'MOVE', 'TRACE']
  var capMethod = method.charAt(0) + method.substring(1).toLowerCase()
  if (methods.indexOf(method) < 0) {
    code.push('class Net::HTTP::%s < Net::HTTPRequest')
    code.push(util.format('class Net::HTTP::%s < Net::HTTPRequest', capMethod))
    code.push(util.format('  METHOD = \'%s\'', method.toUpperCase()))
    code.push(util.format('  REQUEST_HAS_BODY = \'%s\'', self.source.postData.text ? 'true' : 'false'))
    code.push('  RESPONSE_HAS_BODY = true')
    code.push('end')
    code.push(null)
  }

{'fraction_non_alphanumeric': 0.18949880668257757, 'fraction_numerical': 0.002863961813842482, 'mean_word_length': 4.075060532687651, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3714031', 'n_tokens_mistral': 730, 'n_tokens_neox': 709, 'n_words': 175}