<commit_before>package webhook

import (
	"encoding/json"
	"io/ioutil"
	"net/http"

	"github.com/modcloth/docker-builder/job"
)

func JSON(w http.ResponseWriter, req *http.Request) (int, string) {
	// TODO: check encoding type

	body, err := ioutil.ReadAll(req.Body)
	defer req.Body.Close()
	if err != nil {
		return 400, "400 bad request"
	}

	var spec = &job.JobSpec{}
	if err = json.Unmarshal([]byte(body), spec); err != nil {
		return 400, "400 bad request"
	}
	return processJobHelper(spec, w, req)
}<commit_msg>oops, forgot comment for JSON webhook<commit_after>package webhook

import (
	"encoding/json"
	"io/ioutil"
	"net/http"

	"github.com/modcloth/docker-builder/job"
)

/*
JSON parses a simple JSON blob returns a JobSpec
*/
func JSON(w http.ResponseWriter, req *http.Request) (int, string) {
	// TODO: check encoding type

	body, err := ioutil.ReadAll(req.Body)
	defer req.Body.Close()
	if err != nil {
		return 400, "400 bad request"
	}

	var spec = &job.JobSpec{}
	if err = json.Unmarshal([]byte(body), spec); err != nil {
		return 400, "400 bad request"
	}
	return processJobHelper(spec, w, req)
}
{'fraction_non_alphanumeric': 0.14645103324348607, 'fraction_numerical': 0.0215633423180593, 'mean_word_length': 3.995515695067265, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5726420', 'n_tokens_mistral': 443, 'n_tokens_neox': 405, 'n_words': 112}