Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Console/Command/WorkerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class WorkerCommand extends AbstractCommand
public function run(?string $connection = null): void
{
$tries = (int) $this->arg->getParameter('--tries', 3);
$default = $this->arg->getParameter('--queue', "default");
$queue_name = $this->arg->getParameter('--queue', "default");
$memory = (int) $this->arg->getParameter('--memory', 126);
$timout = (int) $this->arg->getParameter('--timout', 3);
$sleep = (int) $this->arg->getParameter('--sleep', 60);
$sleep = (int) $this->arg->getParameter('--sleep', 3);

$queue = app("queue");

Expand All @@ -31,7 +31,7 @@ public function run(?string $connection = null): void

$worker = $this->getWorderService();
$worker->setConnection($queue->getAdapter());
$worker->run($default, $tries, $sleep, $timout, $memory);
$worker->run($queue_name, $tries, $sleep, $timout, $memory);
}

/**
Expand Down
32 changes: 30 additions & 2 deletions src/Http/Client/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ private function addFields(array $data): void
return;
}

if ($this->accept_json) {
if ($this->accept_json || $this->hasHeader('content-type', 'application/json')) {
$payload = json_encode($data);
} else {
$payload = http_build_query($data);
Expand Down Expand Up @@ -377,12 +377,28 @@ public function setUserAgent(string $user_agent): HttpClient
/**
* Configure client to accept and send JSON data
*
* @deprecated 5.2.99
* @return HttpClient
*/
public function acceptJson(): HttpClient
{
$this->accept_json = true;

$this->withHeaders(["Content-Type" => "application/json"]);
$this->withHeaders(["Accept" => "application/json"]);

return $this;
}

/**
* Configure client to accept and send JSON data
*
* @return HttpClient
*/
public function withJson(): HttpClient
{
$this->accept_json = true;

$this->withHeaders(["Content-Type" => "application/json"]);

return $this;
Expand All @@ -398,13 +414,25 @@ public function withHeaders(array $headers): HttpClient
{
foreach ($headers as $key => $value) {
if (!in_array(strtolower($key . ': ' . $value), array_map('strtolower', $this->headers))) {
$this->headers[] = $key . ': ' . $value;
$this->headers[] = trim($key) . ': ' . $value;
}
}

return $this;
}

/**
* Check if header exists
*
* @param string $key
* @param string $value
* @return boolean
*/
public function hasHeader(string $key, string $value): bool
{
return in_array(strtolower($key . ': ' . $value), array_map('strtolower', $this->headers));
}

/**
* Set HTTP authentication credentials
*
Expand Down
2 changes: 1 addition & 1 deletion src/Http/UploadedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function getExtension(): ?string
if (!$this->isUploaded()) {
return null;
}

if (!isset($this->file['name'])) {
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Queue/Adapters/QueueAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,13 @@ public function getQueue(?string $queue = null): string
}

/**
* Watch the queue name
* Set the queue name
*
* @param string $queue
*/
public function setQueue(string $queue): void
{
//
$this->queue = $queue;
}

/**
Expand Down
Loading