Skip to content

Commit 3917f65

Browse files
committed
fix: actually set the content-type
1 parent fcc2e78 commit 3917f65

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

twitterv1/twitterv1.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,15 @@ func EncodeAndSend(c *fiber.Ctx, data interface{}) error {
241241
customHeader := []byte(`<?xml version="1.0" encoding="UTF-8"?>`)
242242
xmlContent = append(customHeader, xmlContent...)
243243

244+
c.Set("Content-Type", "application/xml")
244245
return c.SendString(string(xmlContent))
245246
case "json", "":
246247
encoded, err := json.Marshal(data)
247248
if err != nil {
248249
fmt.Println("Error:", err)
249250
return c.Status(fiber.StatusInternalServerError).SendString("Failed to encode into json!")
250251
}
252+
c.Set("Content-Type", "application/json")
251253
return c.SendString(string(encoded))
252254
default:
253255
return c.Status(fiber.StatusInternalServerError).SendString("Invalid file type!")

0 commit comments

Comments
 (0)