Skip to content

Commit

Permalink
🐛 Fix http-request module
Browse files Browse the repository at this point in the history
  • Loading branch information
Shark committed Aug 18, 2022
1 parent a4d0ac6 commit c86ed26
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN touch ~/.zshrc \
&& rustup component add rustfmt \
&& rustup component add clippy \
&& cargo install cargo-expand \
&& cargo install cargo-wasi \
&& mkdir ~/.cargo \
&& git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh \
&& cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc \
Expand Down
5 changes: 4 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
}
},
"args": [],
"cwd": "${workspaceFolder}"
"cwd": "${workspaceFolder}",
"env": {
"LOG_LEVEL": "debug"
}
},
{
"type": "lldb",
Expand Down
4 changes: 2 additions & 2 deletions crates/workflow-model/src/host/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::model::{INPUT_FILE_NAME, RESULT_FILE_NAME};
use crate::model::{PluginInvocation, PluginResult, INPUT_ARTIFACTS_PATH, OUTPUT_ARTIFACTS_PATH};
use anyhow::Context;
use anyhow::{anyhow, Context};
use std::fmt::{Debug, Formatter};
use std::fs::File;
use std::path::Path;
Expand Down Expand Up @@ -46,7 +46,7 @@ impl WorkingDir {
pub fn result(&self) -> anyhow::Result<PluginResult> {
let result_file = {
let path = self.temp_dir.path().join(RESULT_FILE_NAME);
File::open(path)?
File::open(path).map_err(|err| anyhow!(err).context("Open module result file"))?
};
let plugin_result: PluginResult = serde_json::from_reader(result_file)?;
Ok(plugin_result)
Expand Down
7 changes: 5 additions & 2 deletions wasm-modules/contrib/http-request/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
use anyhow::anyhow;
use serde_json::json;
use std::slice::Iter;
use workflow_model::model::{Outputs, Parameter, Phase, PluginInvocation, PluginResult};
use workflow_model::{
model::{Outputs, Parameter, Phase, PluginInvocation, PluginResult},
plugin::ArtifactManager,
};

fn main() {
workflow_model::plugin::main(Box::new(run));
}

fn run(invocation: PluginInvocation) -> anyhow::Result<PluginResult> {
fn run(invocation: PluginInvocation, _: ArtifactManager) -> anyhow::Result<PluginResult> {
let req_params: RequestInfo = invocation.parameters.try_into()?;

let mut req = http::request::Builder::new()
Expand Down

0 comments on commit c86ed26

Please sign in to comment.