Skip to content

221 response codes#321

Merged
mmacai merged 13 commits intomasterfrom
221-response-codes
Aug 14, 2020
Merged

221 response codes#321
mmacai merged 13 commits intomasterfrom
221-response-codes

Conversation

@mmacai
Copy link
Copy Markdown
Collaborator

@mmacai mmacai commented Jul 30, 2020

Description

Support custom response code for these response_from targets:

  • Kafka
  • HTTP async
  • [-] NATS - NATS -> NATS not implemented as I wasn't able to test it properly
  • [-] Kinesis - Not supported atm

What to look out for

  • tests should cover majority of cases and docs should reflect the proper usage/state

Closes #221

@mmacai mmacai marked this pull request as draft July 30, 2020 16:47
@mmacai
Copy link
Copy Markdown
Collaborator Author

mmacai commented Jul 31, 2020

@kevinbader still have to do some testing and probably missed some places to update, but you can already give it a shot.

@mmacai mmacai marked this pull request as ready for review August 3, 2020 20:31
@mmacai mmacai requested a review from kevinbader August 3, 2020 20:31
@kevinbader kevinbader self-assigned this Aug 4, 2020
@kevinbader kevinbader added this to the 3.0.0 milestone Aug 4, 2020
Comment thread docs/api-gateway.md Outdated
Comment thread docs/api-gateway.md
Comment thread lib/rig_inbound_gateway/api_proxy/response_from_parser.ex Outdated
Comment thread lib/rig_inbound_gateway/api_proxy/response_from_parser.ex Outdated
Comment thread lib/rig_inbound_gateway/api_proxy/response_from_parser.ex Outdated
Comment thread lib/rig_inbound_gateway/api_proxy/response_from_parser.ex
Comment thread lib/rig_inbound_gateway/api_proxy/handler/kafka.ex
Comment thread lib/rig_inbound_gateway/api_proxy/handler/http.ex
Comment thread docs/api-gateway.md

#### Supported formats

All `response_from` options support only binary mode.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not an issue, just a thought: is "binary mode" a common term outside the cloudevents spec?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No idea tbh, but I guess it makes sense to be consistent with such terms.

Comment thread docs/api-gateway.md
Comment thread lib/rig_api/v1/responses.ex Outdated
|> Tracing.Plug.put_resp_header(Tracing.context())
|> Conn.put_resp_content_type("application/json")
|> Conn.send_resp(:ok, response)
|> Conn.send_resp(response_code, response)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what about the content type? Ideally, we'd forward the body as-is and also retain the content-type, then the backend can send whatever

Comment thread lib/rig_inbound_gateway/api_proxy/handler/kafka.ex
Comment thread lib/rig_inbound_gateway/api_proxy/response_from_parser.ex
Comment thread lib/rig_inbound_gateway/api_proxy/response_from_parser.ex Outdated
Comment thread test/rig_tests/proxy/response_from/kafka_test.exs Outdated
Comment thread lib/rig_inbound_gateway/api_proxy/response_from_parser.ex Outdated
Comment thread lib/rig_inbound_gateway/api_proxy/response_from_parser.ex Outdated
@mmacai mmacai merged commit 710dccb into master Aug 14, 2020
@mmacai mmacai deleted the 221-response-codes branch August 14, 2020 06:17
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.

Support HTTP response code with the API's /responses endpoint

2 participants