refactor(http): replace string(w.Body.Bytes()) with w.Body.String() (#18143)

Instead of type converting the Body.Bytes() to a string, we can simply
call Body.String().

While we're at it, this patch also uses a simple string comparison
instead of cmp.Equal() for two strings.

According to the docs, they're equivalent.
pull/18146/head
Ayan George 2020-05-18 17:31:15 -04:00 committed by GitHub
parent c0fe2c30d6
commit b7d3d21313
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1188,7 +1188,7 @@ func TestHandler_Flux_DisabledByDefault(t *testing.T) {
}
exp := "Flux query service disabled. Verify flux-enabled=true in the [http] section of the InfluxDB config.\n"
if got := string(w.Body.Bytes()); !cmp.Equal(got, exp) {
if got := w.Body.String(); got != exp {
t.Fatalf("unexpected body -got/+exp\n%s", cmp.Diff(got, exp))
}
}
@ -1408,7 +1408,7 @@ func TestHandler_Flux(t *testing.T) {
}
if test.expBody != "" {
if got := string(w.Body.Bytes()); !cmp.Equal(got, test.expBody) {
if got := w.Body.String(); got != test.expBody {
t.Fatalf("unexpected body -got/+exp\n%s", cmp.Diff(got, test.expBody))
}
}