输出卷曲请求的响应

时间:2018-06-20 23:08:32

标签: bash curl

我编写了一个bash函数,该函数发出了一个PUT请求并按如下方式打印响应:

foo() {
  echo "$(curl --request PUT "foo.com" ...)"
}

当我从外壳程序调用此函数时,我只看到进度表(而不是响应)。如何修复我的函数,使其输出我的PUT请求的响应?

1 个答案:

答案 0 :(得分:0)

尝试这种单线。为我工作。

import { Component, OnInit, ViewChild, ChangeDetectorRef,ElementRef} from '@angular/core';
import {MatPaginator, MatSort, MatTableDataSource} from '@angular/material';    
import { WorkflowService } from "../workflow.service";
import { HttpClient } from '@angular/common/http';
import {DataSource} from '@angular/cdk/collections';    
import * as XLSX from 'xlsx/xlsx'; 

@Component({
  selector: 'app-table-doc',
  templateUrl: './table-doc.component.html',
  styleUrls: ['./table-doc.component.css']
})

export class TableDocComponent implements OnInit {

 @ViewChild('TABLE') table: ElementRef;
 @ViewChild(MatPaginator) paginator: MatPaginator;
  @ViewChild(MatSort) sort: MatSort;
   displayedColumns = ['MSID','MSPW','MSRequsest','ClassID','ClassName',
   'FirstName','LastName','Email','Role','EmployeeRoleFrom','VendorID',
   'VendorNameCompany','StaffID','Source','HireDate','HireType','EnteredDate',
  'FloorDate','SiteLocation','EmployeeContractorID','TransferFrom','Notes','Status',
  ];  

  dataSource = new MatTableDataSource();   
    constructor( private http:HttpClient,private workflowService : WorkflowService,private changeDetectorRefs: ChangeDetectorRef) {
}

  ngOnInit() {

     this.tableDataSource();         
  }

ngAfterViewInit() {
     this.dataSource.paginator = this.paginator;
     this.dataSource.sort = this.sort;
   }

  applyFilter(filterValue: string) {
    filterValue = filterValue.trim(); // Remove whitespace
    filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches
    this.dataSource.filter = filterValue;
  }

tableDataSource(){
 this.workflowService.GetUploadDocData().subscribe(
      data => {
        this.dataSource.data = data ;

      }  
    );
}

ExportTOExcel() 
{

   const ws:XLSX.WorkSheet=XLSX.utils.table_to_sheet(this.table.nativeElement);
   const wb:XLSX.WorkBook = XLSX.utils.book_new();
    XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
   console.log(this.table.nativeElement);
  /* save to file */
  XLSX.writeFile(wb, 'SheetJS.xlsx');     
} 

}