{"id":16841636,"url":"https://github.com/kevinpollet/nego","last_synced_at":"2025-04-11T05:51:49.746Z","repository":{"id":57517668,"uuid":"246294919","full_name":"kevinpollet/nego","owner":"kevinpollet","description":"Go package providing an implementation of HTTP Content Negotiation compliant with RFC 7231","archived":false,"fork":false,"pushed_at":"2021-10-10T16:09:28.000Z","size":73,"stargazers_count":12,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T03:51:16.388Z","etag":null,"topics":["content-charset","content-encoding","content-language","content-negotiation","content-type","go","golang","http","negotiate","rfc7231"],"latest_commit_sha":null,"homepage":"","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/kevinpollet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2020-03-10T12:27:49.000Z","updated_at":"2022-07-19T08:13:28.000Z","dependencies_parsed_at":"2022-09-06T10:01:51.251Z","dependency_job_id":null,"html_url":"https://github.com/kevinpollet/nego","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinpollet%2Fnego","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinpollet%2Fnego/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinpollet%2Fnego/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinpollet%2Fnego/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevinpollet","download_url":"https://codeload.github.com/kevinpollet/nego/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351410,"owners_count":21089271,"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","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":["content-charset","content-encoding","content-language","content-negotiation","content-type","go","golang","http","negotiate","rfc7231"],"created_at":"2024-10-13T12:42:35.381Z","updated_at":"2025-04-11T05:51:49.725Z","avatar_url":"https://github.com/kevinpollet.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nego\n\n[![Build Status](https://github.com/kevinpollet/nego/workflows/build/badge.svg)](https://github.com/kevinpollet/nego/actions)\n[![GoDoc](https://godoc.org/github.com/kevinpollet/nego?status.svg)](https://pkg.go.dev/github.com/kevinpollet/nego)\n[![Go Report Card](https://goreportcard.com/badge/github.com/kevinpollet/nego?burst=)](https://goreportcard.com/report/github.com/kevinpollet/nego)\n\nGo package providing an implementation of [HTTP Content Negotiation](https://en.wikipedia.org/wiki/Content_negotiation) compliant with [RFC 7231](https://tools.ietf.org/html/rfc7231#section-5.3).\n\nAs defined in [RFC 7231](https://tools.ietf.org/html/rfc7231#section-5.3) the following request headers are sent by a user agent to engage in a proactive negotiation of the response content: `Accept`, `Accept-Charset`, `Accept-Language` and `Accept-Encoding`.\nThis package provides convenient functions to negotiate the best and acceptable response content `type`, `charset`, `language` and `encoding`.\n\n## Installation\n\nInstall using `go get github.com/kevinpollet/nego`.\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"github.com/kevinpollet/nego\"\n)\n\nfunc main() {\n\thandler := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {\n\t\tcontentCharset := nego.NegotiateContentCharset(req, \"utf-8\")\n\t\tcontentEncoding := nego.NegotiateContentEncoding(req, \"gzip\", \"deflate\")\n\t\tcontentLanguage := nego.NegotiateContentLanguage(req, \"fr\", \"en\")\n\t\tcontentType := nego.NegotiateContentType(req, \"text/html\", \"text/plain\")\n\t\t...\n\t})\n}\n```\n\n## Contributing\n\nContributions are welcome!\n\nWant to file a bug, request a feature or contribute some code?\n\n1. Check out the [Code of Conduct](./CODE_OF_CONDUCT.md).\n2. Check for an existing [issue](https://github.com/kevinpollet/nego/issues) corresponding to your bug or feature request.\n3. Open an issue to describe your bug or feature request.\n\n## License\n\n[MIT](./LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinpollet%2Fnego","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinpollet%2Fnego","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinpollet%2Fnego/lists"}