<commit_before>package main

import (
	"encoding/json"
	log "github.com/golang/glog"
	"github.com/jrupac/goliath/storage"
	"net/http"
	"time"
)

const API_VERSION = "1.0"

type feed struct {
	Id          int64  `json:"id"`
	FaviconId   int64  `json:"favicon_id"`
	Title       string `json:"title"`
	Url         string `json:"url"`
	SiteUrl     string `json:"site_url"`
	IsSpark     bool   `json:"is_spark"`
	LastUpdated int64  `json:"last_updated_on_time"`
}

type group struct {
	Id    int64  `json:"id"`
	Title string `json:"title"`
}

type favicon struct {
	Id   int64  `json:"id"`
	Data string `json:"data"`
}

type feedsGroup struct {
	GroupId int64  `json:"group_id"`
	FeedIds string `json:"feed_ids"`
}

func HandleFever(d *storage.Database) func(w http.ResponseWriter, r *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		log.Infof("Handling request.")
		handleFever(d, w, r)
	}
}

func handleFever(d *storage.Database, w http.ResponseWriter, r *http.Request) {
	// These two fields must always be set on responses.
	resp := map[string]interface{}{
		"api_version":            API_VERSION,
		"last_refreshed_on_time": time.Now().Unix(),
	}

	r.ParseForm()
	// Endpoint must be "/fever?api" so check specifically that "api" is in the URL.
	if _, ok := r.Form["api"]; !ok {
		w.WriteHeader(http.StatusBadRequest)
		return
	}

	switch r.Form.Get("api") {
	case "":<commit_msg>Remove strict Fever API endpoint check.<commit_after>package main

import (
	"encoding/json"
	log "github.com/golang/glog"
	"github.com/jrupac/goliath/storage"
	"net/http"
	"time"
)

const API_VERSION = "1.0"

type feed struct {
	Id          int64  `json:"id"`
	FaviconId   int64  `json:"favicon_id"`
	Title       string `json:"title"`
	Url         string `json:"url"`
	SiteUrl     string `json:"site_url"`
	IsSpark     bool   `json:"is_spark"`
	LastUpdated int64  `json:"last_updated_on_time"`
}

type group struct {
	Id    int64  `json:"id"`
	Title string `json:"title"`
}

type favicon struct {
	Id   int64  `json:"id"`
	Data string `json:"data"`
}

type feedsGroup struct {
	GroupId int64  `json:"group_id"`
	FeedIds string `json:"feed_ids"`
}

func HandleFever(d *storage.Database) func(w http.ResponseWriter, r *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		handleFever(d, w, r)
	}
}

func handleFever(d *storage.Database, w http.ResponseWriter, r *http.Request) {
	// These two fields must always be set on responses.
	resp := map[string]interface{}{
		"api_version":            API_VERSION,
		"last_refreshed_on_time": time.Now().Unix(),
	}

	r.ParseForm()

	switch r.Form.Get("api") {
	case "":
{'fraction_non_alphanumeric': 0.14350797266514806, 'fraction_numerical': 0.010630220197418374, 'mean_word_length': 3.7996357012750455, 'pattern_counts': {'":': 6, '<': 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': '1125509', 'n_tokens_mistral': 1004, 'n_tokens_neox': 968, 'n_words': 234}