Skip to content

Add App-Version HttpHeaderType to header method in HttpHeadersInjector #28

@ortegadn

Description

@ortegadn

Actualmente en el HttpHeaderInjector se puede definir el valor del HttpHeaderType.appVersion, pero en el método de headers no se encuentra contemplado (tampoco los headers extras):

  Future<Map<String, String>> headers({Map<String, String>? extra}) async {
    final acceptLanguage = await getHeader(HttpHeaderType.acceptLanguage.key) ??
        extra?[HttpHeaderType.acceptLanguage.key];
    final authToken = extra?[HttpHeaderType.authorization.key] ??
        await getHeader(HttpHeaderType.authorization.key);
    final xToken = extra?[HttpHeaderType.xToken.key] ??
        await getHeader(HttpHeaderType.xToken.key);
    final accept = extra?[HttpHeaderType.accept.key] ?? 'application/json';
    final contentType =
        extra?[HttpHeaderType.contentType.key] ?? 'application/json';

    return {
      HttpHeaderType.accept.key: accept,
      HttpHeaderType.contentType.key: contentType,
      if (acceptLanguage != null)
        HttpHeaderType.acceptLanguage.key: acceptLanguage,
      if (xToken != null && xToken.isNotEmpty)
        HttpHeaderType.xToken.key: xToken,
      if (authToken != null && authToken.isNotEmpty)
        HttpHeaderType.authorization.key: authToken,
    };
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions