You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: absmatch.go
    path of file: ./repos/keploy/pkg/service/test
    
    the code of the file until where you have to start completion: package test

import (
	"encoding/json"
	"strings"

	"go.keploy.io/server/pkg"
	"go.keploy.io/server/pkg/models"
	"go.uber.org/zap"
)

// AbsMatch (Absolute Match) compares two test cases and returns a boolean value indicating whether they are equal or not.
// It also returns a AbsResult object which contains the results of the comparison.
// Parameters: tcs1, tcs2, noiseConfig, logger
// Returns: bool, *models.AbsResult
func AbsMatch(tcs1, tcs2 *models.TestCase, noiseConfig models.GlobalNoise, logger *zap.Logger) (bool, *models.AbsResult) {
	if tcs1 == nil || tcs2 == nil {
		logger.Error("test case is nil", zap.Any("tcs1", tcs1), zap.Any("tcs2", tcs2))
		return false, nil
	}

	pass := true
	absResult := &models.AbsResult{}

	kindResult := models.StringResult{
		Normal:   false,
		Expected: string(tcs1.Kind),
		Actual:   string(tcs2.Kind),
	}

	nameResult := models.StringResult{
		Normal:   false,
		Expected: tcs1.Name,
		Actual:   tcs2.Name,
	}

	curlResult := models.StringResult{
		Normal:   false,
		Expected: tcs1.Curl,
		Actual:   tcs2.Curl,
	}

	//compare kind
	if tcs1.Kind == tcs2.Kind {
		kindResult.Normal = true
	} else {
		logger.Debug("test case kind is not equal", zap.Any("tcs1Kind", tcs1.Kind), zap.Any("tcs2Kind", tcs2.Kind))
		pass = false
	}

	//compare name
	if tcs1.Name == tcs2.Name {
		nameResult.Normal = true
	} else {
		logger.Debug("test case name is not equal", zap.Any("tcs1Name", tcs1.Name), zap.Any("tcs2Name", tcs2.Name))
		pass = false
	}

	//compare curl
	ok := CompareCurl(tcs1.Curl, tcs2.Curl, logger)
	if ok {
		curlResult.Normal = true
	} else {
		logger.Debug("test case curl is not equal", zap.Any("tcs1Curl", tcs1.Curl), zap.Any("tcs2Curl", tcs2.Curl))
		pass = false
	}

	//compare http req
	reqPass, reqResult := CompareHTTPReq(tcs1, tcs2, noiseConfig, logger)
	if !reqPass {
		logger.Debug("test case http req is not equal", zap.Any("tcs1HttpReq", tcs1.HttpReq), zap.Any("tcs2HttpReq", tcs2.HttpReq))
		pass = false
	}

	//compare http resp
	respPass, respResult := CompareHTTPResp(tcs1, tcs2, noiseConfig, logger)
	if !respPass {
		logger.Debug("test case http resp is not equal", zap.Any("tcs1HttpResp", tcs1.HttpResp), zap.Any("tcs2HttpR
    
func CompareHTTPResp(tcs1, tcs2 *models.TestCase, noiseConfig models.GlobalNoise, logger *zap.Logger) (bool, models.RespResult) {
	pass := true
	//compare http resp
	respResult := models.RespResult{
		StatusCode: models.IntResult{
			Normal:   false,
			Expected: tcs1.HttpResp.StatusCode,
			Actual:   tcs2.HttpResp.StatusCode,
		},
		HeadersResult: []models.HeaderResult{},
		BodyResult: models.BodyResult{
			Normal:   false,
			Expected: tcs1.HttpResp.Body,
			Actual:   tcs2.HttpResp.Body,
		},
	}

	if tcs1.HttpResp.StatusCode == tcs2.HttpResp.StatusCode {
		respResult.StatusCode.Normal = true
	} else {
		logger.Debug("test case http resp status code is not equal", zap.Any("tcs1HttpRespStatusCode", tcs1.HttpResp.StatusCode), zap.Any("tcs2HttpRespStatusCode", tcs2.HttpResp.StatusCode))
		pass = false
	}

	//compare the auto added noise in test case
	noise1 := tcs1.Noise
	noise2 := tcs2.Noise
	ok := CompareNoise(noise1, noise2, logger)
	if !ok {
		logger.Debug("test case noise is not equal", zap.Any("tcs1Noise", tcs1.Noise), zap.Any("tcs2Noise", tcs2.Noise))
		logger.Debug("response body and headers can not be compared because noise is not equal")
		pass = false
		return pass, respResult
	}

	noise := noise1

	var (
		bodyNoise   = noiseConfig["body"]
		headerNoise = noiseConfig["header"]
	)

	if bodyNoise == nil {
		bodyNoise = map[string][]string{}
	}
	if headerNoise == nil {
		headerNoise = map[string][]string{}
	}

	for field, regexArr := range noise {
		a := strings.Split(field, ".")
		if len(a) > 1 && a[0] == "body" {
			x := strings.Join(a[1:], ".")
			bodyNoise[x] = regexArr
		} else if a[0] == "header" {
			headerNoise[a[len(a)-1]] = regexArr
		}
	}

	// compare http resp headers
	ok = CompareHeaders(pkg.ToHttpHeader(tcs1.HttpResp.Header), pkg.ToHttpHeader(tcs2.HttpResp.Header), &respResult.HeadersResult, headerNoise)
	if !ok {
		logger.Debug("test case http resp headers are not equal", zap.Any("tcs1HttpRespHeaders", tcs1.HttpResp.Header), zap.Any("tcs2HttpRespHeaders", tcs2.HttpResp.Header))
		pass = false
	}

	// compare http resp body
	bodyType1 := models.BodyTypePlain
	if json.Valid([]byte(tcs1.HttpResp.Body)) {
		bodyType1 = models.BodyTypeJSON
	}

	bodyType2 := models.BodyTypePlain
	if json.Valid([]byte(tcs2.HttpResp.Body)) {
		bodyType2 = models.BodyTypeJSON
	}

	if bodyType1 != bodyType2 {
		logger.Debug("test case http resp body type is not equal", zap.Any("tcs1HttpRespBodyType", bodyType1), zap.Any("tcs2HttpRespBodyType", bodyType2))
		pass = false
	} else {
		if !Contains(MapToArray(noise), "body") && bodyType1 == models.BodyTypeJSON {
			cleanExp, cleanAct := tcs1.HttpResp.Body, tcs2.HttpResp.Body
			var jsonComparisonResult jsonComparisonResult
			validatedJSON, err := ValidateAndMarshalJson(logger, &cleanExp, &cleanAct)
			if err != nil {
				logger.Debug("test case http resp body is not equal", zap.Any("tcs1HttpReqBody", tcs1.HttpReq.Body), zap.Any("tcs2HttpReqBody", tcs2.HttpReq.Body))
				pass = false
			}
			if validatedJSON.isIdentical {
				jsonComparisonResult, err = JsonDiffWithNoiseControl(logger, validatedJSON, bodyNoise, false)
				pass = jsonComparisonResult.isExact
				if err != nil || !jsonComparisonResult.matches {
					logger.Debug("test case http resp body is not equal", zap.Any("tcs1HttpRespBody", tcs1.HttpResp.Body), zap.Any("tcs2HttpRespBody", tcs2.HttpResp.Body))
					pass = false
				} else {
					respResult.BodyResult.Normal = true
				}
			} else {
				pass = false
			}

			logger.Debug("ExpResp", zap.Any("", cleanExp))
			logger.Debug("ActResp", zap.Any("", cleanAct))
			logger.Debug("SameOrder", zap.Any("", jsonComparisonResult.isExact))
		} else {
			if !Contains(MapToArray(noise), "body") && tcs1.HttpResp.Body != tcs2.HttpResp.Body {
				logger.Debug("test case http resp body is not equal", zap.Any("tcs1HttpRespBody", tcs1.HttpResp.Body), zap.Any("tcs2HttpRespBody", tcs2.HttpResp.Body))
				pass = false
			} else {
				respResult.BodyResult.Normal = true
			}
		}
	}
	return pass, respResult
}