[GITEA] feat(nuget): basic manifest download
Refs: https://codeberg.org/forgejo/forgejo/pulls/2222 (cherry picked from commit 5f837efc15f3d1e0d7fbed7fc569251143266584) fix: write xml header (cherry picked from commit a715984a42be9da81c48106d5eae244098ac1108) fix: optional elements and xml schema (cherry picked from commit 6ea6895a3616246e7282aa20d8f010fa931b60ea) fix: pass all other requests to file search (cherry picked from commit 9bfc74833a3b657453b4519573598432a87e3e3c) test: add integration test (cherry picked from commit b798f4ce86daa78e694c5c142e6f5f44938e6cb6) fix: use xmlResponse (cherry picked from commit 7f76df0b246c64fac0eeb115642c8cb6eb676f36) (cherry picked from commit e18d574ca40905aec52fbbe8247ba83fd01874dd)
This commit is contained in:
parent
bfe87e30af
commit
97cc955101
3 changed files with 170 additions and 64 deletions
|
@ -353,6 +353,21 @@ AAAjQmxvYgAAAGm7ENm9SGxMtAFVvPUsPJTF6PbtAAAAAFcVogEJAAAAAQAAAA==`)
|
|||
|
||||
assert.Equal(t, content, resp.Body.Bytes())
|
||||
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("%s/package/%s/%s/%s.nuspec", url, packageName, packageVersion, packageName)).
|
||||
AddBasicAuth(user.Name)
|
||||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
nuspec := `<?xml version="1.0" encoding="UTF-8"?>` + "\n" +
|
||||
`<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"><metadata>` +
|
||||
`<id>` + packageName + `</id><version>` + packageVersion + `</version><authors>` + packageAuthors + `</authors><description>` + packageDescription + `</description>` +
|
||||
`<dependencies><group targetFramework=".NETStandard2.0">` +
|
||||
// https://github.com/golang/go/issues/21399 go can't generate self-closing tags
|
||||
`<dependency id="Microsoft.CSharp" version="4.5.0"></dependency>` +
|
||||
`</group></dependencies>` +
|
||||
`</metadata></package>`
|
||||
|
||||
assert.Equal(t, nuspec, resp.Body.String())
|
||||
|
||||
checkDownloadCount(1)
|
||||
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("%s/package/%s/%s/%s.%s.snupkg", url, packageName, packageVersion, packageName, packageVersion)).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue