<commit_before>'use strict'

var Promise = require('bluebird')
var request = require('request')
var config = require('../config')

module.exports = opts => {
  opts = opts instanceof Object ? opts : {}
  return new Promise ((resolve, reject) => {
    request({
      url: [ 'https://bnw.im/api', opts.endpoint ].join('/'),
      method: opts.method || 'get',
      json: true,
      form: opts.form,
      qs: opts.qs
    }, (e, res, body) => {
      if (body && !body.ok && body.description) {
        return reject(new Error(body.description))
      }

      if (!e && res.statusCode !== 200) {
        e = new Error('HTTP ' + res.statusCode)<commit_msg>correct desc<commit_after>'use strict'

var Promise = require('bluebird')
var request = require('request')
var config = require('../config')

module.exports = opts => {
  opts = opts instanceof Object ? opts : {}
  return new Promise ((resolve, reject) => {
    request({
      url: [ 'https://bnw.im/api', opts.endpoint ].join('/'),
      method: opts.method || 'get',
      json: true,
      form: opts.form,
      qs: opts.qs
    }, (e, res, body) => {
      if (body && !body.ok && body.desc) {
        return reject(new Error(body.desc))
      }

      if (!e && res.statusCode !== 200) {
        e = new Error('HTTP ' + res.statusCode)
{'fraction_non_alphanumeric': 0.18041634541249035, 'fraction_numerical': 0.004626060138781804, 'mean_word_length': 2.6055555555555556, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '6554881', 'n_tokens_mistral': 414, 'n_tokens_neox': 402, 'n_words': 110}