iri
iri copied to clipboard
Allow IXI to manage more than POST HTTP requests
Description
The previous PR was born to allow IXI Modules to decide the content-type they wish to send to the client. The idea is that clients might want to, for example, load web content directly on their browser, get data in XML format, images, or whatever the IXI module serves.
My interest in this topic started from the same goal, precisely to be able to serve web content directly from the node. This functionality is currently not available due to missing handling or HTTP requests different than POST.
Previous PR #743
Previous PR was created for issue #615
Type of change
- Enhancement (a non-breaking change which adds functionality)
The previous PR provided changes to enable the node to make HTTP requests different from POST to be managed as fallback by IXI modules. The changes didn't modify previous POST handling, that's why I would classify the change as enhancement.
I created this new PR because the previous one was developed on iri version 1.4.1.
To improve the previous work I implemented a different handling of X-IOTA-API-Version check management, that is now executed during body parsing, instead of repeating the check in each branch of the switch case (in process function).
I added comments to new functions.
I would like to reopen the discussion about this feature that could be a good enhancement to the iri functionalities.
How Has This Been Tested?
First of all I tried old ixi modules to check if updates are backcompatible (as https://github.com/iotaledger/iri/pull/743#issuecomment-389479482 asked), even if most of them are deprecated. Moreover I used an easy IXI module to check if the html content was correctly provided.
I launched unit tests and there is a problem I would like to discuss about. The result state:
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]com.iota.iri.service.APIIntegrationTests.com.iota.iri.service.APIIntegrationTests
[ERROR] Run 1: APIIntegrationTests.setUp:91 » SpentAddresses There is a problem with accessin...
[ERROR] Run 2: APIIntegrationTests.tearDown:118 Exception occurred shutting down IOTA node [INFO]
[INFO]
[ERROR] Tests run: 233, Failures: 0, Errors: 1, Skipped: 1
I'm not really sure this is due to changes.
Checklist:
- [x] My code follows the style guidelines for this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas