Skip to content

Instantly share code, notes, and snippets.

@sonya
Created November 4, 2021 02:42
Show Gist options
  • Select an option

  • Save sonya/3ea4f2bcebfcaed2c8c3cf7be7f62f34 to your computer and use it in GitHub Desktop.

Select an option

Save sonya/3ea4f2bcebfcaed2c8c3cf7be7f62f34 to your computer and use it in GitHub Desktop.

Revisions

  1. sonya created this gist Nov 4, 2021.
    14 changes: 14 additions & 0 deletions gock_test.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    func TestGetFixedValue(t *testing.T) {
    defer gock.Off()

    gock.New("https://example.com/fixedvalue").
    MatchHeader("Accept", "application/json").
    Get("/").
    Reply(200).
    JSON(map[string]string{"value": "fixed"})

    value, _ := GetFixedValue("https://example.com")
    if value != "fixed" {
    t.Errorf("Expected 'fixed', got %s", value)
    }
    }