Skip to content

Commit

Permalink
- conflict changes
Browse files Browse the repository at this point in the history
  • Loading branch information
laststylebender14 committed Dec 9, 2024
1 parent c178372 commit e0c8e11
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
9 changes: 5 additions & 4 deletions src/core/generator/proto/connect_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl From<Grpc> for Http {

Self {
url: new_url,
body: body.map(|b| b.to_string()),
body,
method: crate::core::http::Method::POST,
headers,
batch_key,
Expand Down Expand Up @@ -91,7 +91,7 @@ mod tests {

assert_eq!(http.url, "http://localhost:8080/package.service/method");
assert_eq!(http.method, crate::core::http::Method::POST);
assert_eq!(http.body, Some(r#"{"key":"value"}"#.to_string()));
assert_eq!(http.body, Some(json!({"key": "value"})));
}

#[test]
Expand All @@ -109,7 +109,7 @@ mod tests {

let http = Http::from(grpc);

assert_eq!(http.body, Some("{}".to_string()));
assert_eq!(http.body, Some(json!({})));
}

#[test]
Expand All @@ -136,6 +136,7 @@ mod tests {
.value,
"bar".to_string()
);
assert_eq!(http.body, Some(json!({})));
}

#[test]
Expand All @@ -155,7 +156,7 @@ mod tests {

assert_eq!(http.url, "http://localhost:8080/package.service/method");
assert_eq!(http.method, crate::core::http::Method::POST);
assert_eq!(http.body, Some(r#"{"key":"value"}"#.to_string()));
assert_eq!(http.body, Some(json!({"key": "value"})));
assert_eq!(
http.headers
.iter()
Expand Down
11 changes: 6 additions & 5 deletions src/core/ir/eval_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,14 @@ impl<'a, 'ctx, Context: ResolverContextLike + Sync> EvalHttp<'a, 'ctx, Context>
pub async fn execute_with_worker<'worker: 'async_recursion>(
&self,
mut request: DynamicRequest<String>,
worker: &Arc<dyn WorkerIO<worker::Event, worker::Command>>,
http_filter: &HttpFilter,
worker_ctx: WorkerContext<'worker>,
) -> Result<Response<async_graphql::Value>, Error> {
let js_request = worker::WorkerRequest::try_from(request.request())?;
let event = worker::Event::Request(js_request);
// extract variables from the worker context.
let js_hooks = worker_ctx.js_hooks;
let worker = worker_ctx.worker;
let js_worker = worker_ctx.js_worker;

let response = match js_hooks.on_request(worker, &request).await? {
let response = match js_hooks.on_request(worker, &request.request()).await? {

Check failure on line 114 in src/core/ir/eval_http.rs

View workflow job for this annotation

GitHub Actions / Run Formatter and Lint Check

this expression creates a reference which is immediately dereferenced by the compiler
Some(command) => match command {
worker::Command::Request(w_request) => {
let response = self.execute(w_request.try_into()?).await?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ type News {
}

type Query {
GEN__news__NewsService__AddNews(news: GEN__news__NewsInput!): News @http(url: "http://localhost:50051/news.NewsService/AddNews", body: "\"{{.args.news}}\"", method: "POST")
GEN__news__NewsService__DeleteNews(newsId: Id!): Empty @http(url: "http://localhost:50051/news.NewsService/DeleteNews", body: "\"{{.args.newsId}}\"", method: "POST")
GEN__news__NewsService__EditNews(news: GEN__news__NewsInput!): News @http(url: "http://localhost:50051/news.NewsService/EditNews", body: "\"{{.args.news}}\"", method: "POST")
GEN__news__NewsService__GetAllNews: GEN__news__NewsList @http(url: "http://localhost:50051/news.NewsService/GetAllNews", body: "{}", method: "POST")
GEN__news__NewsService__GetMultipleNews(multipleNewsId: GEN__news__MultipleNewsId!): GEN__news__NewsList @http(url: "http://localhost:50051/news.NewsService/GetMultipleNews", body: "\"{{.args.multipleNewsId}}\"", method: "POST")
GEN__news__NewsService__GetNews(newsId: Id!): News @http(url: "http://localhost:50051/news.NewsService/GetNews", body: "\"{{.args.newsId}}\"", method: "POST")
GEN__news__NewsService__AddNews(news: GEN__news__NewsInput!): News @http(url: "http://localhost:50051/news.NewsService/AddNews", body: "{{.args.news}}", method: "POST")
GEN__news__NewsService__DeleteNews(newsId: Id!): Empty @http(url: "http://localhost:50051/news.NewsService/DeleteNews", body: "{{.args.newsId}}", method: "POST")
GEN__news__NewsService__EditNews(news: GEN__news__NewsInput!): News @http(url: "http://localhost:50051/news.NewsService/EditNews", body: "{{.args.news}}", method: "POST")
GEN__news__NewsService__GetAllNews: GEN__news__NewsList @http(url: "http://localhost:50051/news.NewsService/GetAllNews", body: {}, method: "POST")
GEN__news__NewsService__GetMultipleNews(multipleNewsId: GEN__news__MultipleNewsId!): GEN__news__NewsList @http(url: "http://localhost:50051/news.NewsService/GetMultipleNews", body: "{{.args.multipleNewsId}}", method: "POST")
GEN__news__NewsService__GetNews(newsId: Id!): News @http(url: "http://localhost:50051/news.NewsService/GetNews", body: "{{.args.newsId}}", method: "POST")
users: [User] @http(url: "http://jsonplaceholder.typicode.com/users")
}

Expand Down

0 comments on commit e0c8e11

Please sign in to comment.