{"id":13413859,"url":"https://github.com/h2non/baloo","last_synced_at":"2025-10-09T09:17:46.843Z","repository":{"id":49787796,"uuid":"59965014","full_name":"h2non/baloo","owner":"h2non","description":"Expressive end-to-end HTTP API testing made easy in Go","archived":false,"fork":false,"pushed_at":"2022-08-10T03:18:54.000Z","size":75,"stargazers_count":782,"open_issues_count":9,"forks_count":30,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-10-03T16:41:03.340Z","etag":null,"topics":["assert","expectations","gentleman","golang","http","http-api-debug","json-schema","testing"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/h2non/baloo","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/h2non.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-29T21:40:58.000Z","updated_at":"2025-09-11T23:52:59.000Z","dependencies_parsed_at":"2022-08-28T08:21:34.828Z","dependency_job_id":null,"html_url":"https://github.com/h2non/baloo","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/h2non/baloo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2non%2Fbaloo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2non%2Fbaloo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2non%2Fbaloo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2non%2Fbaloo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/h2non","download_url":"https://codeload.github.com/h2non/baloo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2non%2Fbaloo/sbom","scorecard":{"id":451560,"data":{"date":"2025-08-11","repo":{"name":"github.com/h2non/baloo","commit":"f0f8a3baabae3ddda1103bf1c67af7b04c635f5d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":2,"reason":"Found 5/21 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"CII-Best-Practices","score":2,"reason":"badge detected: InProgress","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 14 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T08:18:36.337Z","repository_id":49787796,"created_at":"2025-08-19T08:18:36.338Z","updated_at":"2025-08-19T08:18:36.338Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278343086,"owners_count":25971400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assert","expectations","gentleman","golang","http","http-api-debug","json-schema","testing"],"created_at":"2024-07-30T20:01:51.378Z","updated_at":"2025-10-09T09:17:46.799Z","avatar_url":"https://github.com/h2non.png","language":"Go","funding_links":[],"categories":["Template Engines","Misc","Go","Testing","测试","testing","测试相关","测试相关`测试库和测试数据集生成库`","Testing Frameworks","測試","\u003cspan id=\"测试-testing\"\u003e测试 Testing\u003c/span\u003e"],"sub_categories":["Testing Frameworks","Advanced Console UIs","HTTP Clients","HTTP客户端","高级控制台界面","交流","查询语","高級控制台界面","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"readme":"# baloo [![Build Status](https://travis-ci.org/h2non/baloo.svg)](https://travis-ci.org/h2non/baloo) [![GitHub release](https://img.shields.io/badge/version-3.0-orange.svg?style=flat)](https://github.com/h2non/baloo/releases) [![GoDoc](https://godoc.org/github.com/h2non/baloo?status.svg)](https://godoc.org/github.com/h2non/baloo) [![Coverage Status](https://coveralls.io/repos/github/h2non/baloo/badge.svg?branch=master)](https://coveralls.io/github/h2non/baloo?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/h2non/baloo)](https://goreportcard.com/report/github.com/h2non/baloo)\n\nExpressive and versatile end-to-end HTTP API testing made easy in [Go](http://golang.org) (golang), built on top of [gentleman](https://github.com/h2non/gentleman) HTTP client toolkit.\n\nTake a look to the [examples](#examples) to get started.\n\n## Features\n\n- Versatile built-in expectations.\n- Extensible custom expectations.\n- Declarative, expressive, fluent API.\n- Response body matching and strict equality expectations.\n- Deep JSON comparison.\n- JSON Schema validation.\n- Full-featured HTTP client built on top of [gentleman](https://github.com/h2non/gentleman) toolkit.\n- Intuitive and semantic HTTP client DSL.\n- Easy to configure and use.\n- Composable chainable assertions.\n- Works with Go's `testing` package (more test engines might be added in the future).\n- Convenient helpers and abstractions over Go's HTTP primitives.\n- Middleware-oriented via gentleman's [middleware layer](https://github.com/h2non/gentleman#middleware).\n- Extensible and hackable API.\n\n## Versions\n\n- [v3](https://github.com/h2non/baloo) - Latest stable version with better JSON assertion. Uses `gentleman@v2`. Recommended.\n- [v2](https://github.com/h2non/baloo/tree/v2.0.0) - Stable version. Uses `gentleman@v2`.\n- [v1](https://github.com/h2non/baloo/tree/v1) - First version. Stable. Uses `gentleman@v1`. Actively maintained.\n\n## Installation\n\n```bash\ngo get -u gopkg.in/h2non/baloo.v3\n```\n\n## Requirements\n\n- Go 1.7+\n\n## Examples\n\nSee [examples](https://github.com/h2non/baloo/blob/master/_examples) directory for featured examples.\n\n#### Simple request expectation\n\n```go\npackage simple\n\nimport (\n  \"testing\"\n\n  \"gopkg.in/h2non/baloo.v3\"\n)\n\n// test stores the HTTP testing client preconfigured\nvar test = baloo.New(\"http://httpbin.org\")\n\nfunc TestBalooSimple(t *testing.T) {\n  test.Get(\"/get\").\n    SetHeader(\"Foo\", \"Bar\").\n    Expect(t).\n    Status(200).\n    Header(\"Server\", \"apache\").\n    Type(\"json\").\n    JSON(map[string]string{\"bar\": \"foo\"}).\n    Done()\n}\n```\n\n#### Custom assertion function\n\n```go\npackage custom_assertion\n\nimport (\n  \"errors\"\n  \"net/http\"\n  \"testing\"\n\n  \"gopkg.in/h2non/baloo.v3\"\n)\n\n// test stores the HTTP testing client preconfigured\nvar test = baloo.New(\"http://httpbin.org\")\n\n// assert implements an assertion function with custom validation logic.\n// If the assertion fails it should return an error.\nfunc assert(res *http.Response, req *http.Request) error {\n  if res.StatusCode \u003e= 400 {\n    return errors.New(\"Invalid server response (\u003e 400)\")\n  }\n  return nil\n}\n\nfunc TestBalooClient(t *testing.T) {\n  test.Post(\"/post\").\n    SetHeader(\"Foo\", \"Bar\").\n    JSON(map[string]string{\"foo\": \"bar\"}).\n    Expect(t).\n    Status(200).\n    Type(\"json\").\n    AssertFunc(assert).\n    Done()\n}\n```\n\n#### JSON Schema assertion\n\n```go\npackage json_schema\n\nimport (\n  \"testing\"\n\n  \"gopkg.in/h2non/baloo.v3\"\n)\n\nconst schema = `{\n  \"title\": \"Example Schema\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"origin\": {\n      \"type\": \"string\"\n    }\n  },\n  \"required\": [\"origin\"]\n}`\n\n// test stores the HTTP testing client preconfigured\nvar test = baloo.New(\"http://httpbin.org\")\n\nfunc TestJSONSchema(t *testing.T) {\n  test.Get(\"/ip\").\n    Expect(t).\n    Status(200).\n    Type(\"json\").\n    JSONSchema(schema).\n    Done()\n}\n```\n\n#### Custom global assertion by alias\n\n```go\npackage alias_assertion\n\nimport (\n  \"errors\"\n  \"net/http\"\n  \"testing\"\n\n  \"gopkg.in/h2non/baloo.v3\"\n)\n\n// test stores the HTTP testing client preconfigured\nvar test = baloo.New(\"http://httpbin.org\")\n\nfunc assert(res *http.Response, req *http.Request) error {\n  if res.StatusCode \u003e= 400 {\n    return errors.New(\"Invalid server response (\u003e 400)\")\n  }\n  return nil\n}\n\nfunc init() {\n  // Register assertion function at global level\n  baloo.AddAssertFunc(\"test\", assert)\n}\n\nfunc TestBalooClient(t *testing.T) {\n  test.Post(\"/post\").\n    SetHeader(\"Foo\", \"Bar\").\n    JSON(map[string]string{\"foo\": \"bar\"}).\n    Expect(t).\n    Status(200).\n    Type(\"json\").\n    Assert(\"test\").\n    Done()\n}\n```\n\n## API\n\nSee [godoc reference](https://godoc.org/github.com/h2non/baloo) for detailed API documentation.\n\n### HTTP assertions\n\n#### Status(code int)\n\nAsserts the response HTTP status code to be equal.\n\n#### StatusRange(start, end int)\n\nAsserts the response HTTP status to be within the given numeric range.\n\n#### StatusOk()\n\nAsserts the response HTTP status to be a valid server response (\u003e= 200 \u0026\u0026 \u003c 400).\n\n#### StatusError()\n\nAsserts the response HTTP status to be a valid clint/server error response (\u003e= 400 \u0026\u0026 \u003c 600).\n\n#### StatusServerError()\n\nAsserts the response HTTP status to be a valid server error response (\u003e= 500 \u0026\u0026 \u003c 600).\n\n#### StatusClientError()\n\nAsserts the response HTTP status to be a valid client error response (\u003e= 400 \u0026\u0026 \u003c 500).\n\n#### Type(kind string)\n\nAsserts the `Content-Type` header. MIME type aliases can be used as `kind` argument.\n\nSupported aliases: `json`, `xml`, `html`, `form`, `text` and `urlencoded`.\n\n#### Header(key, value string)\n\nAsserts a response header field value matches.\n\nRegular expressions can be used as value to perform the specific assertions.\n\n#### HeaderEquals(key, value string)\n\nAsserts a response header field with the given value.\n\n#### HeaderNotEquals(key, value string)\n\nAsserts that a response header field is not equal to the given value.\n\n#### HeaderPresent(key string)\n\nAsserts if a header field is present in the response.\n\n#### HeaderNotPresent(key string)\n\nAsserts if a header field is not present in the response.\n\n#### BodyEquals(value string)\n\nAsserts a response body as string using strict comparison.\n\nRegular expressions can be used as value to perform the specific assertions.\n\n#### BodyMatchString(pattern string)\n\nAsserts a response body matching a string expression.\n\nRegular expressions can be used as value to perform the specific assertions.\n\n#### BodyLength(length int)\n\nAsserts the response body length.\n\n#### JSON(match interface{})\n\nAsserts the response body with the given JSON struct.\n\n#### JSONSchema(schema string)\n\nAsserts the response body againts the given JSON schema definition.\n\n`data` argument can be a `string` containing the JSON schema, a file path\nor an URL pointing to the JSON schema definition.\n\n#### Assert(alias string)\n\nAssert adds a new assertion function by alias name.\n\nAssertion function must be previosly registered\nvia baloo.AddAssertFunc(\"alias\", function).\n\nSee [an example here](#custom-global-assertion-by-alias).\n\n#### AssertFunc(func (*http.Response, *http.Request) error)\n\nAdds a new custom assertion function who should return an\ndetailed error in case that the assertion fails.\n\n## Development\n\nClone this repository:\n```bash\ngit clone https://github.com/h2non/baloo.git \u0026\u0026 cd baloo\n```\n\nInstall dependencies:\n```bash\ngo get -u ./...\n```\n\nRun tests:\n```bash\ngo test ./...\n```\n\nLint code:\n```bash\ngo test ./...\n```\n\nRun example:\n```bash\ngo test ./_examples/simple/simple_test.go\n```\n\n## License\n\nMIT - Tomas Aparicio\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh2non%2Fbaloo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fh2non%2Fbaloo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh2non%2Fbaloo/lists"}