-
Notifications
You must be signed in to change notification settings - Fork 203
Add --header/-H to dapr invoke #1287
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
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7a8b16b
Add --header/-H to dapr invoke
hunter007 90ae537
Merge branch 'master' into issue_1286
shubham1172 da89235
Fix S1031: unnecessary nil check around range (gosimple)
hunter007 6c5274f
Merge branch 'issue_1286' of github.com:hunter007/dapr-cli into issue…
hunter007 c6be417
Add E2E for dapr invoke
hunter007 bbaa314
Merge branch 'master' into issue_1286
hunter007 b5bf40d
Merge branch 'master' into issue_1286
hunter007 b35d562
Merge branch 'master' into issue_1286
mukundansundar 3fc267b
Merge branch 'master' into issue_1286
hunter007 fbd2638
Merge branch 'master' into issue_1286
hunter007 9fab57b
update github.com/dapr/go-sdk from v1.6.0 to v1.8.0
hunter007 e458f37
Merge branch 'master' into issue_1286
mukundansundar ddd24fb
Fix
hunter007 90bc493
Merge branch 'master' into issue_1286
hunter007 83d8a3a
Merge branch 'master' into issue_1286
mukundansundar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ package standalone | |
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
"os" | ||
"runtime" | ||
"testing" | ||
|
@@ -35,13 +36,15 @@ func TestInvoke(t *testing.T) { | |
listErr error | ||
expectedPath string | ||
postResponse string | ||
header http.Header | ||
resp string | ||
}{ | ||
{ | ||
name: "list apps error", | ||
errorExpected: true, | ||
errString: assert.AnError.Error(), | ||
listErr: assert.AnError, | ||
header: nil, | ||
}, | ||
{ | ||
name: "appID not found", | ||
|
@@ -51,6 +54,7 @@ func TestInvoke(t *testing.T) { | |
lo: ListOutput{ | ||
AppID: "testapp", | ||
}, | ||
header: nil, | ||
}, | ||
{ | ||
name: "appID found successful invoke empty response", | ||
|
@@ -59,6 +63,7 @@ func TestInvoke(t *testing.T) { | |
lo: ListOutput{ | ||
AppID: "testapp", | ||
}, | ||
header: nil, | ||
}, | ||
{ | ||
name: "appID found successful invoke", | ||
|
@@ -69,8 +74,23 @@ func TestInvoke(t *testing.T) { | |
}, | ||
expectedPath: "/v1.0/invoke/testapp/method/test", | ||
postResponse: "test payload", | ||
header: nil, | ||
resp: "successful invoke", | ||
}, | ||
{ | ||
name: "appID found successful invoke with customized header", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add one test with multiple header values. |
||
appID: "testapp", | ||
method: "test", | ||
lo: ListOutput{ | ||
AppID: "testapp", | ||
}, | ||
expectedPath: "/v1.0/invoke/testapp/method/test", | ||
postResponse: "test payload", | ||
resp: "successful invoke", | ||
header: http.Header{ | ||
"Customized-Header": []string{"Value"}, | ||
}, | ||
}, | ||
} | ||
|
||
for _, socket := range []string{"", "/tmp"} { | ||
|
@@ -105,7 +125,7 @@ func TestInvoke(t *testing.T) { | |
}, | ||
} | ||
|
||
res, err := client.Invoke(tc.appID, tc.method, []byte(tc.resp), "GET", socket) | ||
res, err := client.Invoke(tc.appID, tc.method, []byte(tc.resp), "GET", tc.header, socket) | ||
if tc.errorExpected { | ||
assert.Error(t, err, "expected an error") | ||
assert.Equal(t, tc.errString, err.Error(), "expected error strings to match") | ||
|
@@ -137,7 +157,7 @@ func TestInvoke(t *testing.T) { | |
Err: tc.listErr, | ||
}, | ||
} | ||
res, err := client.Invoke(tc.appID, tc.method, []byte(tc.resp), "POST", socket) | ||
res, err := client.Invoke(tc.appID, tc.method, []byte(tc.resp), "POST", tc.header, socket) | ||
if tc.errorExpected { | ||
assert.Error(t, err, "expected an error") | ||
assert.Equal(t, tc.errString, err.Error(), "expected error strings to match") | ||
|
@@ -169,7 +189,7 @@ func TestInvoke(t *testing.T) { | |
Err: tc.listErr, | ||
}, | ||
} | ||
res, err := client.Invoke(tc.appID, tc.method, []byte(tc.resp), "DELETE", socket) | ||
res, err := client.Invoke(tc.appID, tc.method, []byte(tc.resp), "DELETE", tc.header, socket) | ||
if tc.errorExpected { | ||
assert.Error(t, err, "expected an error") | ||
assert.Equal(t, tc.errString, err.Error(), "expected error strings to match") | ||
|
@@ -202,7 +222,7 @@ func TestInvoke(t *testing.T) { | |
Err: tc.listErr, | ||
}, | ||
} | ||
res, err := client.Invoke(tc.appID, tc.method, []byte(tc.resp), "PUT", socket) | ||
res, err := client.Invoke(tc.appID, tc.method, []byte(tc.resp), "PUT", tc.header, socket) | ||
if tc.errorExpected { | ||
assert.Error(t, err, "expected an error") | ||
assert.Equal(t, tc.errString, err.Error(), "expected error strings to match") | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.