<commit_before>package routes

import (
	"fmt"
	"log"
	"net/http"

	"github.com/julienschmidt/httprouter"
	"github.com/votinginfoproject/sms-web/queue"
	"github.com/votinginfoproject/sms-web/sms"
	"github.com/votinginfoproject/sms-web/status"
	"github.com/yvasiyarov/gorelic"
)

type Server struct {
	handler http.Handler
}

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	r.ParseForm()

	log.Print(fmt.Sprintf("[INFO] [REQUEST] Method: %s - Path: %s - Host: %s, FormData: %s", r.Method, r.URL.RequestURI(), r.Host, r.Form))

	s.handler.ServeHTTP(w, r)
}

func New(q queue.ExternalQueueService, agent *gorelic.Agent) *Server {
	routes := httprouter.New()

	routes.PanicHandler = func(res http.ResponseWriter, req *http.Request, _ interface{}) {
		res.WriteHeader(http.StatusInternalServerError)
		res.Header().Set("Content-Type", "text/plain")
		log.Print("[ERROR] : ", req)
	}

	routes.GET("/status", status.Get)

	if q != nil {
		sms.WireUp(q)
	}
	routes.POST("/", sms.Receive)

	if agent != nil {<commit_msg>remove unneeded content-type from 500<commit_after>package routes

import (
	"fmt"
	"log"
	"net/http"

	"github.com/julienschmidt/httprouter"
	"github.com/votinginfoproject/sms-web/queue"
	"github.com/votinginfoproject/sms-web/sms"
	"github.com/votinginfoproject/sms-web/status"
	"github.com/yvasiyarov/gorelic"
)

type Server struct {
	handler http.Handler
}

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	r.ParseForm()

	log.Print(fmt.Sprintf("[INFO] [REQUEST] Method: %s - Path: %s - Host: %s, FormData: %s", r.Method, r.URL.RequestURI(), r.Host, r.Form))

	s.handler.ServeHTTP(w, r)
}

func New(q queue.ExternalQueueService, agent *gorelic.Agent) *Server {
	routes := httprouter.New()

	routes.PanicHandler = func(res http.ResponseWriter, req *http.Request, _ interface{}) {
		res.WriteHeader(http.StatusInternalServerError)
		log.Print("[ERROR] : ", req)
	}

	routes.GET("/status", status.Get)

	if q != nil {
		sms.WireUp(q)
	}
	routes.POST("/", sms.Receive)

	if agent != nil {
{'fraction_non_alphanumeric': 0.16756491915727584, 'fraction_numerical': 0.0014698677119059284, 'mean_word_length': 4.518918918918919, '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': '6564837', 'n_tokens_mistral': 822, 'n_tokens_neox': 800, 'n_words': 142}