mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-26 18:20:57 +00:00
feat(nuget): basic manifest download
This commit is contained in:
parent
9fe826605f
commit
5f837efc15
3 changed files with 127 additions and 46 deletions
|
@ -5,6 +5,7 @@ package context
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
@ -136,6 +137,15 @@ func (b *Base) JSON(status int, content any) {
|
|||
}
|
||||
}
|
||||
|
||||
// XML render content as XML
|
||||
func (b *Base) XML(status int, content any) {
|
||||
b.Resp.Header().Set("Content-Type", "application/xml;charset=utf-8")
|
||||
b.Resp.WriteHeader(status)
|
||||
if err := xml.NewEncoder(b.Resp).Encode(content); err != nil {
|
||||
log.Error("Render XML failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// RemoteAddr returns the client machine ip address
|
||||
func (b *Base) RemoteAddr() string {
|
||||
return b.Req.RemoteAddr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue