We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fcc2e78 commit 3917f65Copy full SHA for 3917f65
1 file changed
twitterv1/twitterv1.go
@@ -241,13 +241,15 @@ func EncodeAndSend(c *fiber.Ctx, data interface{}) error {
241
customHeader := []byte(`<?xml version="1.0" encoding="UTF-8"?>`)
242
xmlContent = append(customHeader, xmlContent...)
243
244
+ c.Set("Content-Type", "application/xml")
245
return c.SendString(string(xmlContent))
246
case "json", "":
247
encoded, err := json.Marshal(data)
248
if err != nil {
249
fmt.Println("Error:", err)
250
return c.Status(fiber.StatusInternalServerError).SendString("Failed to encode into json!")
251
}
252
+ c.Set("Content-Type", "application/json")
253
return c.SendString(string(encoded))
254
default:
255
return c.Status(fiber.StatusInternalServerError).SendString("Invalid file type!")
0 commit comments