-
Notifications
You must be signed in to change notification settings - Fork 189
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
[tests-only][full-ci] add tests for checking the header location for tus upload #10807
base: master
Are you sure you want to change the base?
Conversation
b79bb57
to
e9d5edd
Compare
e61de04
to
c78d8a1
Compare
c78d8a1
to
0ec975d
Compare
ee5defd
to
91ea534
Compare
91ea534
to
0842b80
Compare
d592bae
to
fa52f68
Compare
db2f7b6
to
c860b81
Compare
* @throws GuzzleException | ||
* @throws ReflectionException | ||
*/ | ||
public function publicUploadFileUsingTus( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use the above existing method (update if necessary)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saw-jan Could you check the changes I made to this function and let me know if they are what you meant?
9afc1e7
to
d715bbf
Compare
Signed-off-by: nabim777 <[email protected]>
Signed-off-by: nabim777 <[email protected]>
Signed-off-by: nabim777 <[email protected]>
Signed-off-by: nabim777 <[email protected]>
Signed-off-by: nabim777 <[email protected]>
Signed-off-by: nabim777 <[email protected]>
Signed-off-by: nabim777 <[email protected]>
c8883d7
to
f12a814
Compare
Signed-off-by: nabim777 <[email protected]>
f12a814
to
a2fd9b6
Compare
* @return ResponseInterface | ||
* @throws GuzzleException | ||
*/ | ||
public function createUploadWithResponse(string $key, int $bytes = -1): ResponseInterface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we want to reflect the existing methods but return differently, I recommend appending a char like this.
public function createUploadWithResponse(string $key, int $bytes = -1): ResponseInterface { | |
public function createWithUploadR(string $key, int $bytes = -1): ResponseInterface { |
* @throws GuzzleException | ||
* @throws TusException | ConnectionException | ||
*/ | ||
public function uploadWithResponse(int $bytes = -1): ResponseInterface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function uploadWithResponse(int $bytes = -1): ResponseInterface { | |
public function uploadR(int $bytes = -1): ResponseInterface { |
try { | ||
$response = $this->getClient()->patch( | ||
$this->getUrl(), | ||
[ | ||
'body' => $data, | ||
'headers' => $headers, | ||
] | ||
); | ||
} catch (ClientException $e) { | ||
throw $this->handleClientException($e); | ||
} | ||
return $response; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just return a response?
if ($this->isPartial()) { | ||
$headers += ['Upload-Concat' => 'partial']; | ||
} | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if we need try catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saw-jan
First of all thanks for the docs.
As documet you have shared
can I add 'http_errors' => false,
on post ?
it says it'll disable throwing exceptions on an HTTP protocol errors (i.e., 4xx and 5xx responses).
$response = $this->getClient()->post(
$this->apiPath,
[
'body' => $data,
'headers' => $headers,
'http_errors' => false,
]
);
@@ -46,7 +46,7 @@ class TusClient extends Client { | |||
* @return ResponseInterface | |||
* @throws GuzzleException | |||
*/ | |||
public function createUploadWithResponse(string $key, int $bytes = -1): ResponseInterface { | |||
public function createWithUploadR(string $key, int $bytes = -1): ResponseInterface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function createWithUploadR(string $key, int $bytes = -1): ResponseInterface { | |
public function createUploadWithResponse(string $key, int $bytes = -1): ResponseInterface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createUploadWithResponse
is not a good name here. create with response
seems a bit odd.
we are mimicking createWithUpload
method from parent class but this time it retruns response. So, either createWithUploadR
or createWithUploadRR
- return response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can have a comment for the method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can i have comment like this?
creates a resource with a post request and returns response
1a16898
to
4381533
Compare
Signed-off-by: nabim777 <[email protected]>
4381533
to
11993f0
Compare
Quality Gate passedIssues Measures |
Description
Since current test uses TUS library for tus operations and is unable to get and check the response.
Due to this, there was no check for the location header on TUS upload.
So, in this PR, following things are done:
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: