Skip to content

Commit

Permalink
feat(filter): send request body to presidio
Browse files Browse the repository at this point in the history
  • Loading branch information
qlonik committed Mar 7, 2024
1 parent 0251fce commit ea5eece
Showing 1 changed file with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,13 @@ import (
)

func PiiAnalysis(presidioSvcURL string, svcName string, bufferBytes []byte) (string, error) {
var jsonBody = `{
"key_F": {
"key_a1": "My phone number is 212-121-1424"
},
"URL": "www.abc.com",
"key_c": 3,
"names": ["James Bond", "Clark Kent", "Hakeem Olajuwon", "No name here!"],
"address": "123 Alpha Beta, Waterloo ON N2L3G1, Canada",
"DOB": "01-01-1989",
"gender": "Female",
"race": "Asian",
"language": "English"
}`

svcNameBuf, err := json.Marshal(svcName)
if err != nil {
return "", fmt.Errorf("could not marshal service name string into a valid JSON string: %w", err)
}

// TODO replace jsonBody with bufferBytes input arg
msgString := `{"json_to_analyze":` + jsonBody + `,"derive_purpose":` + string(svcNameBuf) + `}`
msgString := `{"json_to_analyze":` + string(bufferBytes) + `,"derive_purpose":` + string(svcNameBuf) + `}`

resp, err := http.Post(presidioSvcURL, "application/json", bytes.NewBufferString(msgString))
if err != nil {
Expand Down

0 comments on commit ea5eece

Please sign in to comment.