{"id":37112246,"url":"https://github.com/tombuildsstuff/go-autorest","last_synced_at":"2026-01-14T13:17:01.585Z","repository":{"id":57516824,"uuid":"100735226","full_name":"tombuildsstuff/go-autorest","owner":"tombuildsstuff","description":"This package implements an HTTP request pipeline suitable for use across multiple go-routines and provides the shared routines relied on by AutoRest (see https://github.com/Azure/autorest/) generated Go code.","archived":false,"fork":true,"pushed_at":"2023-03-23T18:06:19.000Z","size":4598,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-15T10:43:01.157Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Azure/go-autorest","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tombuildsstuff.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.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":"2017-08-18T17:25:34.000Z","updated_at":"2023-03-23T18:06:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tombuildsstuff/go-autorest","commit_stats":null,"previous_names":[],"tags_count":100,"template":false,"template_full_name":null,"purl":"pkg:github/tombuildsstuff/go-autorest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tombuildsstuff%2Fgo-autorest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tombuildsstuff%2Fgo-autorest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tombuildsstuff%2Fgo-autorest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tombuildsstuff%2Fgo-autorest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tombuildsstuff","download_url":"https://codeload.github.com/tombuildsstuff/go-autorest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tombuildsstuff%2Fgo-autorest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-14T13:17:00.731Z","updated_at":"2026-01-14T13:17:01.569Z","avatar_url":"https://github.com/tombuildsstuff.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NOTE: The modules in this repo will go out of support by March 31, 2023.  Additional information can be found [here](https://azure.microsoft.com/updates/support-for-azure-sdk-libraries-that-do-not-conform-to-our-current-azure-sdk-guidelines-will-be-retired-as-of-31-march-2023/).\n\n# go-autorest\n\n[![GoDoc](https://godoc.org/github.com/Azure/go-autorest/autorest?status.png)](https://godoc.org/github.com/Azure/go-autorest/autorest)\n[![Build Status](https://dev.azure.com/azure-sdk/public/_apis/build/status/go/Azure.go-autorest?branchName=master)](https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=625\u0026branchName=master)\n[![Go Report Card](https://goreportcard.com/badge/Azure/go-autorest)](https://goreportcard.com/report/Azure/go-autorest)\n\nPackage go-autorest provides an HTTP request client for use with [Autorest](https://github.com/Azure/autorest.go)-generated API client packages.\n\nAn authentication client tested with Azure Active Directory (AAD) is also\nprovided in this repo in the package\n`github.com/Azure/go-autorest/autorest/adal`.  Despite its name, this package\nis maintained only as part of the Azure Go SDK and is not related to other\n\"ADAL\" libraries in [github.com/AzureAD](https://github.com/AzureAD).\n\n## Overview\n\nPackage go-autorest implements an HTTP request pipeline suitable for use across\nmultiple goroutines and provides the shared routines used by packages generated\nby [Autorest](https://github.com/Azure/autorest.go).\n\nThe package breaks sending and responding to HTTP requests into three phases: Preparing, Sending,\nand Responding. A typical pattern is:\n\n```go\n  req, err := Prepare(\u0026http.Request{},\n    token.WithAuthorization())\n\n  resp, err := Send(req,\n    WithLogging(logger),\n    DoErrorIfStatusCode(http.StatusInternalServerError),\n    DoCloseIfError(),\n    DoRetryForAttempts(5, time.Second))\n\n  err = Respond(resp,\n\t\tByDiscardingBody(),\n    ByClosing())\n```\n\nEach phase relies on decorators to modify and / or manage processing. Decorators may first modify\nand then pass the data along, pass the data first and then modify the result, or wrap themselves\naround passing the data (such as a logger might do). Decorators run in the order provided. For\nexample, the following:\n\n```go\n  req, err := Prepare(\u0026http.Request{},\n    WithBaseURL(\"https://microsoft.com/\"),\n    WithPath(\"a\"),\n    WithPath(\"b\"),\n    WithPath(\"c\"))\n```\n\nwill set the URL to:\n\n```\n  https://microsoft.com/a/b/c\n```\n\nPreparers and Responders may be shared and re-used (assuming the underlying decorators support\nsharing and re-use). Performant use is obtained by creating one or more Preparers and Responders\nshared among multiple go-routines, and a single Sender shared among multiple sending go-routines,\nall bound together by means of input / output channels.\n\nDecorators hold their passed state within a closure (such as the path components in the example\nabove). Be careful to share Preparers and Responders only in a context where such held state\napplies. For example, it may not make sense to share a Preparer that applies a query string from a\nfixed set of values. Similarly, sharing a Responder that reads the response body into a passed\nstruct (e.g., `ByUnmarshallingJson`) is likely incorrect.\n\nErrors raised by autorest objects and methods will conform to the `autorest.Error` interface.\n\nSee the included examples for more detail. For details on the suggested use of this package by\ngenerated clients, see the Client described below.\n\n## Helpers\n\n### Handling Swagger Dates\n\nThe Swagger specification (https://swagger.io) that drives AutoRest\n(https://github.com/Azure/autorest/) precisely defines two date forms: date and date-time. The\ngithub.com/Azure/go-autorest/autorest/date package provides time.Time derivations to ensure correct\nparsing and formatting.\n\n### Handling Empty Values\n\nIn JSON, missing values have different semantics than empty values. This is especially true for\nservices using the HTTP PATCH verb. The JSON submitted with a PATCH request generally contains\nonly those values to modify. Missing values are to be left unchanged. Developers, then, require a\nmeans to both specify an empty value and to leave the value out of the submitted JSON.\n\nThe Go JSON package (`encoding/json`) supports the `omitempty` tag. When specified, it omits\nempty values from the rendered JSON. Since Go defines default values for all base types (such as \"\"\nfor string and 0 for int) and provides no means to mark a value as actually empty, the JSON package\ntreats default values as meaning empty, omitting them from the rendered JSON. This means that, using\nthe Go base types encoded through the default JSON package, it is not possible to create JSON to\nclear a value at the server.\n\nThe workaround within the Go community is to use pointers to base types in lieu of base types within\nstructures that map to JSON. For example, instead of a value of type `string`, the workaround uses\n`*string`. While this enables distinguishing empty values from those to be unchanged, creating\npointers to a base type (notably constant, in-line values) requires additional variables. This, for\nexample,\n\n```go\n  s := struct {\n    S *string\n  }{ S: \u0026\"foo\" }\n```\nfails, while, this\n\n```go\n  v := \"foo\"\n  s := struct {\n    S *string\n  }{ S: \u0026v }\n```\nsucceeds.\n\nTo ease using pointers, the subpackage `to` contains helpers that convert to and from pointers for\nGo base types which have Swagger analogs. It also provides a helper that converts between\n`map[string]string` and `map[string]*string`, enabling the JSON to specify that the value\nassociated with a key should be cleared. With the helpers, the previous example becomes\n\n```go\n  s := struct {\n    S *string\n  }{ S: to.StringPtr(\"foo\") }\n```\n\n## Install\n\n```bash\ngo get github.com/Azure/go-autorest/autorest\ngo get github.com/Azure/go-autorest/autorest/azure\ngo get github.com/Azure/go-autorest/autorest/date\ngo get github.com/Azure/go-autorest/autorest/to\n```\n\n### Using with Go Modules\nIn [v12.0.1](https://github.com/Azure/go-autorest/pull/386), this repository introduced the following modules.\n\n- autorest/adal\n- autorest/azure/auth\n- autorest/azure/cli\n- autorest/date\n- autorest/mocks\n- autorest/to\n- autorest/validation\n- autorest\n- logger\n- tracing\n\nTagging cumulative SDK releases as a whole (e.g. `v12.3.0`) is still enabled to support consumers of this repo that have not yet migrated to modules.\n\n## License\n\nSee LICENSE file.\n\n-----\n\nThis project has adopted the [Microsoft Open Source Code of\nConduct](https://opensource.microsoft.com/codeofconduct/). For more information\nsee the [Code of Conduct\nFAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact\n[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional\nquestions or comments.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftombuildsstuff%2Fgo-autorest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftombuildsstuff%2Fgo-autorest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftombuildsstuff%2Fgo-autorest/lists"}