<commit_before>/* This is a tiny httpbridge server that was created in order to serve
unit tests for C++ HTTP APIs.
*/
package main

import (
	"fmt"
	"httpbridge"
	"net/http"
	"os"
	// "github.com/IMQS/httpbridge/go/src/httpbridge"  --  How to include httpbridge from a regular project
)

func showHelp() {
	fmt.Printf("unit-test-server <http port> <httpbridge port>\n")
}

func main() {
	if len(os.Args) != 3 {
		showHelp()
		os.Exit(1)
	}

	httpPort := "127.0.0.1:" + os.Args[1]
	hbPort := "127.0.0.1:" + os.Args[2]

	hb := httpbridge.Server{}
	hb.DisableHttpListener = true
	hb.BackendPort = hbPort
	hb.Log.Level = httpbridge.LogLevelInfo
	go func() {
		err := hb.ListenAndServe()
		if err != nil {
			fmt.Printf("Error: %v\n", err)
		}
	}()
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		// Pass request onto httpbridge
		hb.ServeHTTP(w, r)

		// Listen for special stop signal
		if r.URL.Path == "/stop" {
			fmt.Printf("Received stop signal. Exiting\n")
			os.Exit(0)
		}
	})
	http.ListenAndServe(httpPort, nil)
	os.Exit(0)
}<commit_msg>Improve error message of unit-test-server<commit_after>/* This is a tiny httpbridge server that was created in order to serve
unit tests for C++ HTTP APIs.
*/
package main

import (
	"fmt"
	"httpbridge"
	"net/http"
	"os"
	// "github.com/IMQS/httpbridge/go/src/httpbridge"  --  How to include httpbridge from a regular project
)

func showHelp() {
	fmt.Printf("unit-test-server <http port> <httpbridge port>\n")
}

func main() {
	if len(os.Args) != 3 {
		showHelp()
		os.Exit(1)
	}

	httpPort := "127.0.0.1:" + os.Args[1]
	hbPort := "127.0.0.1:" + os.Args[2]

	hb := httpbridge.Server{}
	hb.DisableHttpListener = true
	hb.BackendPort = hbPort
	hb.Log.Level = httpbridge.LogLevelInfo
	go func() {
		err := hb.ListenAndServe()
		if err != nil {
			fmt.Printf("Error: %v\n", err)
		}
	}()
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		// Pass request onto httpbridge
		hb.ServeHTTP(w, r)

		// Listen for special stop signal
		if r.URL.Path == "/stop" {
			fmt.Printf("Received stop signal. Exiting\n")
			os.Exit(0)
		}
	})
	err := http.ListenAndServe(httpPort, nil)
	if err != nil {
		fmt.Printf("Error from http.ListenAndServe: %v\n", err)
	}
	os.Exit(0)
}
{'fraction_non_alphanumeric': 0.16377392078326658, 'fraction_numerical': 0.01602136181575434, 'mean_word_length': 3.3481624758220505, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '5971499', 'n_tokens_mistral': 934, 'n_tokens_neox': 875, 'n_words': 215}