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

Improve web_api plugin #119

Merged
merged 3 commits into from
Apr 16, 2021
Merged

Improve web_api plugin #119

merged 3 commits into from
Apr 16, 2021

Conversation

jeffsf
Copy link
Contributor

@jeffsf jeffsf commented Apr 14, 2021

This is not a priority for v1.35

As noted in #73 the web_api plugin previously created and used the ::wibble namespace, even if the plugin was not enabled. Resolved by moving the proc ::wibble::* definitions into main {}

Seeing duplication of the generation the response object and expecting to add to the API, made generalized "200" returns for JSON and text data.

In resolving that, noted that the port was hard-coded.

Added a /flush action, which calls ::logging::flush_log (Introduced by #114, not merged at this time).


start_idle
proc ::wibble::return_200_json {{content "{status: ok}"}} {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something seems a bit off with your whitespaces here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New code: Single tab indentation, consistent with much of the de1app Tcl code I've worked with.
start_idle: 4 spaces

We probably should come up with a standard (my preference including no trailing whitespace and each file ends with a newline with no blank lines)

I can see arguments for or against spaces/tabs and 4/8-column indentation

jeffsf added 3 commits April 14, 2021 08:00
By moving the declarations into main, it now "does nothing" if not enabled.

Make extension of command set easier with utilties:

    proc ::wibble::return_200_json {{content "{status: ok}"}}
    proc ::wibble::return_200_text {{content "ok"}}

Signed-Off-By: Jeff Kletsky <[email protected]>
Use the settings value instead of being hard-coded to 8080

Signed-Off-By: Jeff Kletsky <[email protected]>
@jeffsf
Copy link
Contributor Author

jeffsf commented Apr 14, 2021

Corrected MIME type on return_200_text to {text/plain charset utf-8}

@Mimoja Mimoja merged commit b44a634 into decentespresso:main Apr 16, 2021
@jeffsf jeffsf deleted the pr-2021-04-13-fix-wibble branch April 19, 2021 05:22
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

Successfully merging this pull request may close these issues.

2 participants