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

Use html as the default output format #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

janhavlin
Copy link
Collaborator

@janhavlin janhavlin commented Feb 4, 2025

Trivial change to implement #13.

I'd use this PR to do a bit more refactoring in this area. Namely, when a new request is submitted, the user follows this flow of endpoints:

  1. http://localhost:8000/?plan-url=https://gitlab.com/testing-farm/tests&plan-name=/testing-farm/sanity
  2. http://localhost:8000/status/html?task-id=3ff31433-5f94-49e8-90e8-cd6f3f0c40a0
  3. http://localhost:8000/?task-id=3ff31433-5f94-49e8-90e8-cd6f3f0c40a0

I find step 2. unnecessary (endpoints /status and /status/html) so I'd ideally remove them and present outputs in / endpoint. It creates inconsistencies when requesting for a different output format, where user follows these endpoints:

  1. http://localhost:8000/?plan-url=https://gitlab.com/testing-farm/tests&plan-name=/testing-farm/sanity&format=json
  2. http://localhost:8000/status?task-id=054fb9d2-9ae1-407b-9ebb-ba25e63bc245

When format=json is used, the result is shown in /status endpoint. /status endpoint implements an another inconsistency regarding format specification. While / endpoint specifies format via the format=foo query parameter, /status has it built in its path (/status for json, /status/html for html).

Copy link

Title

Use html as the default output format


PR Type

Enhancement


Description

  • Changed the default output format to html.

  • Updated redirect URL to remove explicit format=html.


Changes walkthrough 📝

Relevant files
Enhancement
api.py
Default output format set to `html`                                           

src/tmt_web/api.py

  • Changed the default output format from json to html.
  • Updated redirect URL to omit explicit format=html parameter.
  • +2/-2     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    API Compatibility

    Changing the default output format from JSON to HTML might affect existing API clients that don't explicitly specify a format. Ensure this change is properly communicated to API consumers.

    ] = "html",

    @janhavlin janhavlin linked an issue Feb 4, 2025 that may be closed by this pull request
    Copy link

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    Use html as the default output format
    1 participant