Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0.0-pre-release]c.Attachment download file is 0 byte #2

Closed
cheft opened this issue Jan 21, 2020 · 2 comments
Closed

[1.0.0-pre-release]c.Attachment download file is 0 byte #2

cheft opened this issue Jan 21, 2020 · 2 comments

Comments

@cheft
Copy link

cheft commented Jan 21, 2020

Use c.Attachment("./test.txt"), the download file is 0 bytes.

The source file has content, but the download does not

app.Get("/files/test", func(c *fiber.Ctx) {
  c.Attachment("./test.txt")
})
@cheft cheft changed the title [1.0.0-pre-release] Use c.Attachment("./test.txt"),the download file is 0 bytes [1.0.0-pre-release]c.Attachment download file is 0 byte Jan 21, 2020
@Fenny
Copy link
Member

Fenny commented Jan 21, 2020

Hi @cheft

Attachment only sets the Content-Disposition header.

I think you are after SendFile, you can find more information under the Ctx documentation

app.Get("/fiber/test", func(c *fiber.Ctx) {
  c.SendFile("./test.txt")
})

@cheft
Copy link
Author

cheft commented Jan 21, 2020

sorry, I understand wrong. thx!

@cheft cheft closed this as completed Jan 21, 2020
Fenny pushed a commit that referenced this issue Feb 5, 2020
Update fork from source
koddr added a commit that referenced this issue Feb 12, 2020
Merge pull request #134 from koddr/master
koddr added a commit that referenced this issue Mar 2, 2020
Accumulative update @ 01 Mar 2020
Fenny pushed a commit that referenced this issue Oct 22, 2020
Fenny pushed a commit that referenced this issue Nov 9, 2020
Fenny added a commit that referenced this issue Nov 14, 2020
the-hotmann pushed a commit to the-hotmann/fiber that referenced this issue Feb 10, 2024
ReneWerner87 pushed a commit that referenced this issue Feb 10, 2024
* Update listen.go (unform INFO prints at startip + cosmetics)

BEFORE:
```
    _______ __             
   / ____(_) /_  ___  _____
  / /_  / / __ \/ _ \/ ___/
 / __/ / / /_/ /  __/ /    
/_/   /_/_.___/\___/_/     v3.0.0-beta.1
--------------------------------------------------
INFO Server started on http://127.0.0.1:8003 (bound on host 0.0.0.0 and port 8003)
INFO Application name: TEST APP
INFO Total handlers count: 5
INFO Prefork: Disabled
INFO PID: 2342
INFO Total process count: 1
20:49:50 | 200 |     593.769µs |   123.123.123.123 | GET     | / 
```

AFTER:
```
    _______ __             
   / ____(_) /_  ___  _____
  / /_  / / __ \/ _ \/ ___/
 / __/ / / /_/ /  __/ /    
/_/   /_/_.___/\___/_/     v3.0.0-beta.1
--------------------------------------------------
INFO Server started on:      http://127.0.0.1:8003 (bound on host 0.0.0.0 and port 8003)
INFO Application name:       TEST APP
INFO Total handlers count:   5
INFO Prefork:                Disabled
INFO PID:                    2342
INFO Total process count:    1

20:49:50 | 200 |     593.769µs |   123.123.123.123 | GET     | /
```

* fix spacer

* fix indentation for fiber version

* fix linting

* fix linting #2

* fix listen_test.go to match newly expected output.

* fix test again

---------

Co-authored-by: root <root@clicon.hosting-hotmann.de>
Co-authored-by: Martin <martin@hotmann.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants