func TestParseStringFromBody(t *testing.T) {
	rawBody, asStruct := prepInputData()
	req := makeRequest(&rawBody, "")
	pq := extract.DissectJSONRequest(req, map[string]string{})
	actual := pq.FromBody("stringAsString").Required().AsString()
	expected := asStruct.StringAsString
	assert.Equal(t, expected, actual)
	assert.Nil(t, pq.Error, "Should have no error")
}
Verify reading/converting from Body
package dissectors_test
import (
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"net/url"
	"strconv"
	"strings"
	"testing"
	"time"
	"github.com/stretchr/testify/assert"
	extract "github.com/theparanoids/ashirt-server/backend/server/dissectors"
)
type dummyRequest struct {
	StringAsString           string    `json:"stringAsString"`
	IntAsNumber              float64   `json:"intAsNumber"`
	IntAsString              string    `json:"intAsString"`
	FloatAsNumber            float64   `json:"floatAsNumber"`
	FloatAsString            string    `json:"floatAsString"`
	IntSliceAsNumberArray    []float64 `json:"intSliceAsNumberArray"`
	StringSliceAsStringArray []string  `json:"stringSliceAsStringArray"`
	BoolAsBool               bool      `json:"boolAsBool"`
	BoolAsString             string    `json:"boolAsString"`
	TimeAsRFC3339            time.Time `json:"timeAsRFC3339"`
	TimeAsRFC3339WithTZ      time.Time `json:"timeAsRFC3339WithTZ"`
}
const rawJSON = `{
	"stringAsString": "someString",
	"intAsNumber": 2048,
	"intAsString": "1024",
	"floatAsNumber": 3.14,
	"floatAsString": "2.71",
	"intSliceAsNumberArray": [4, 8, 15, 16, 23, 42],
	"stringSliceAsStringArray": ["do", "you", "want", "to", "play", "a", "game?"],
	"boolAsBool": true,
	"boolAsString": "true",
	"timeAsRFC3339": "2001-01-31T11:22:33Z",
	"timeAsRFC3339WithTZ": "2001-01-31T11:22:33-07:00"
}`
func TestGetRequiredAfterError(t *testing.T) {
	rawBody, _ := prepInputData()
	req := makeRequest(&rawBody, "")
	pq := extract.DissectJSONRequest(req, map[string]string{})
	str := pq.FromBody("DoesNotExit").Required().AsString()
	assert.NotNil(t, pq.Error, "Should have an error")
	someErr := pq.Error
	str2 := pq.FromBody("OtherEmptyField").Required().AsString()
	otherErr := pq.Error
	assert.Equal(t, str, "")
	assert.Equal(t, str2, "")
	assert.Equal(t, someErr, otherErr)
}
func TestNoBody(t *testing.T) {
	req := makeRequest(nil, "")
	pq := extract.DissectJSONRequest(req, map[string]string{})
	assert.Nil(t, pq.Error, "Should have no error")
}
func TestNotJSONBody(t *testing.T) {
	notJson := "[}"
	req := makeRequest(&notJson, "")
	pq := extract.DissectJSONRequest(req, map[string]string{})
	assert.NotNil(t, pq.Error, "Should have a parse error")
}
func TestNoContentAsString(t *testing.T) {
	req := makeRequest(nil, "")
	pq := extract.DissectJSONRequest(req, map[string]string{})
	actual := pq.FromBody("DoesNotExist").AsString()
	expected := ""
	assert.Equal(t, expected, actual, "On Unparsable, zero value should be returned")
	assert.Nil(t, pq.Error, "Should have no error")
}
func TestNoContentAsRequiredString(t *testing.T) {
	req := makeRequest(nil, "")
	pq := extract.DissectJSONRequest(req, map[string]string{})
	actual := pq.FromBody("DoesNotExist").Required().AsString()
	expected := ""
	assert.Equal(t, expected, actual, "On Unparsable, zero value should be returned")
	assert.NotNil(t, pq.Error, "Should have an error")
}
func TestNoContentAsInt64(t *testing.T) {
	req := makeRequest(nil, "")
	pq := extract.DissectJSONRequest(req, map[string]string{})
	actual := pq.FromBody("DoesNotExist").AsInt64()
	expected := int64(0)
	assert.Equal(t, expected, actual, "On Unparsable, zero value should be returned")
	assert.Nil(t, pq.Error, "Should have no error")
}
func TestStringAsInt64(t *testing.T) {
	rawBody, _ := prepInputData()
	req := makeRequest(&rawBody, "")
	pq := extract.DissectJSONRequest(req, map[string]string{})
	actual := pq.FromBody("stringAsString").Required().AsInt64()
	expected := int64(0)
	assert.Equal(t, expected, actual, "On Unparsable, zero value should be returned")
	assert.NotNil(t, pq.Error, "Reqquired values that do not coerce should have an error")
}
func TestNoContentAsRequiredInt64(t *testing.T) {
	req := makeRequest(nil, "")
	pq := extract.DissectJSONRequest(req, map[string]string{})
	actual := pq.FromBody("DoesNotExist").Required().AsInt64()
	expected := int64(0)
	assert.Equal(t, expected, actual, "On Unparsable, zero value should be returned")
	assert.NotNil(t, pq.Error, "Should have an error")
}
func TestDefaultValue(t *testing.T) {
	rawBody, _ := prepInputData()
	req := makeRequest(&rawBody, "")
	pq := extract.DissectJSONRequest(req, map[string]string{})
	defaultValue := "It's Okay"
	actual := pq.FromBody("DoesNotExist").OrDefault(defaultValue).AsString()
	expected := defaultValue
	assert.Nil(t, pq.Error)
	assert.Equal(t, expected, actual, "Default value should be used")
}
func TestRequiredValue_doesNotExist(t *testing.T) {
	rawBody, _ := prepInputData()
	req := makeRequest(&rawBody, "")
	pq := extract.DissectJSONRequest(req, map[string]string{})
	actual := pq.FromBody("DoesNotExist").Required().AsString()
	expected := ""
	assert.NotNil(t, pq.Error)
	assert.Equal(t, expected, actual, "On Unparsable, zero value should be returned")
}