Skip to content
New issue

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

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

Already on GitHub? # to your account

Response headers are not displayed #8

Open
Demianeen opened this issue May 1, 2024 · 4 comments
Open

Response headers are not displayed #8

Demianeen opened this issue May 1, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@Demianeen
Copy link

When I run bootdev cli I don't see headers. For example for routing lesson:
CleanShot 2024-05-01 at 09 53 23@2x

I can see headers in any other rest clients. Also, the lesson submission does work.

CleanShot 2024-05-01 at 09 56 40@2x

@cgsdev0
Copy link
Member

cgsdev0 commented May 1, 2024

we filter the headers to only show the ones being tested for

the behavior is kinda confusing, I will try to see if I can think of a way to make it more obvious 👍

@Demianeen
Copy link
Author

Sure. As an idea, I think you can highlight the headers that are being tested

@cgsdev0 cgsdev0 added the enhancement New feature or request label May 3, 2024
@Waldeedle
Copy link

image

Would something like this make sense? We iterate through the result headers and use lipgloss to style any matches from the expected headers as green otherwise output them as grey. Then we can also loop through the expected headers and output any missing ones as red.

		for k, v := range result.Headers {
			if req.Request.Headers[k] == v {
				fmt.Print(green.Render(fmt.Sprintf("   - %v: %v", k, v)) + "\n")
			} else {
				fmt.Printf(gray.Render(fmt.Sprintf("   - %v: %v", k, v)) + "\n")
			}
		}
		for k, v := range req.Request.Headers {
			if _, found := result.Headers[k]; !found {
				fmt.Printf(red.Render(fmt.Sprintf("   - %v: %v", k, v)) + "\n")
			}
		}

@cgsdev0
Copy link
Member

cgsdev0 commented May 15, 2024

@Waldeedle that looks nice!

I'm going to rewrite the render functions for the HTTP tests soon to match the fancy ones we have for the commands now, I'll keep this idea in mind

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants