GODT-175: Add option to attach logs for bug reports

This commit is contained in:
Alexander Bilyak
2021-10-11 13:24:41 +00:00
committed by Jakub
parent b259de238e
commit e49d2e1be7
11 changed files with 248 additions and 38 deletions

View File

@ -38,7 +38,7 @@ func (m *manager) ReportBug(ctx context.Context, rep ReportBugReq) error {
r := m.r(ctx).SetMultipartFormData(rep.GetMultipartFormData())
for _, att := range rep.Attachments {
r = r.SetMultipartField(att.name, att.filename, "application/octet-stream", att.body)
r = r.SetMultipartField(att.name, att.name, att.mime, att.body)
}
if _, err := wrapNoConnection(r.Post("/reports/bug")); err != nil {

View File

@ -29,8 +29,8 @@ const (
)
type reportAtt struct {
name, filename string
body io.Reader
name, mime string
body io.Reader
}
// ReportBugReq stores data for report.
@ -56,8 +56,8 @@ type ReportBugReq struct {
}
// AddAttachment to report.
func (rep *ReportBugReq) AddAttachment(name, filename string, r io.Reader) {
rep.Attachments = append(rep.Attachments, reportAtt{name: name, filename: filename, body: r})
func (rep *ReportBugReq) AddAttachment(name, mime string, r io.Reader) {
rep.Attachments = append(rep.Attachments, reportAtt{name: name, mime: mime, body: r})
}
func (rep *ReportBugReq) GetMultipartFormData() map[string]string {