docs: Add REST endpoints migration guide (#8011)

* Add REST endpoints migration guide

* add bank, distrib, evidence

* Add slashing, mint

* Add staking

* Add query

* Add todo

* Typos

* Add link to interact node

* grammar

* Better wording

* Update docs/migrations/rest.md

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* Update docs/migrations/rest.md

* Add footnote

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
This commit is contained in:
Amaury
2020-11-24 14:34:20 +00:00
committed by GitHub
co-authored by Robert Zaremba
parent 53294f5269
commit 13bc504bec
3 changed files with 99 additions and 3 deletions
+6 -1
View File
@@ -6,12 +6,17 @@ import (
"github.com/gorilla/mux"
)
// DeprecationURL is the URL for migrating deprecated REST endpoints to newer ones.
// TODO Switch to `/` (not `/master`) once v0.40 docs are deployed.
// https://github.com/cosmos/cosmos-sdk/issues/8019
const DeprecationURL = "https://docs.cosmos.network/master/migrations/rest.html"
// addHTTPDeprecationHeaders is a mux middleware function for adding HTTP
// Deprecation headers to a http handler
func addHTTPDeprecationHeaders(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Deprecation", "true")
w.Header().Set("Link", "<https://docs.cosmos.network/v0.40/interfaces/rest.html>; rel=\"deprecation\"")
w.Header().Set("Link", "<"+DeprecationURL+">; rel=\"deprecation\"")
w.Header().Set("Warning", "199 - \"this endpoint is deprecated and may not work as before, see deprecation link for more info\"")
h.ServeHTTP(w, r)
})